Accessing Page description and keywords with API

Posted by Community Admin on 04-Aug-2018 19:25

Accessing Page description and keywords with API

All Replies

Posted by Community Admin on 12-Apr-2012 00:00

Hi!

I'm using 

var pages = App.WorkWith().Pages().Get().ToList();
to get list of pages. When I try to access single page property description and keywords (that are standard fields for page) I have a problem:
pages[0].Description - doesn't return actual value inserted at page creation 
pages[0].Keywords - doesn't even exist

Am I missing something here?
Is there a diferent way to access those two values.

Bostjan

Posted by Community Admin on 12-Apr-2012 00:00

Hi Bostjan,

the Get() method for the Fluent API actually returns a list of type PageNode. The data you want is within this type under Page.

So you can access the properties you want with something like this:

var pages = App.WorkWith().Pages().Get();
foreach (var pagenode in pages)
    var keywords = pagenode.Page.Keywords;
    var description = pagenode.Page.Description;

hope this is helpful!

This thread is closed