1-888-365-2779
+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / Accessing Page description and keywords with API

Accessing Page description and keywords with API

2 posts, 1 answered
  1. bzagozen
    bzagozen avatar
    4 posts
    Registered:
    15 Feb 2012
    12 Apr 2012
    Link to this post
    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

  2. SelAromDotNet
    SelAromDotNet avatar
    912 posts
    Registered:
    18 Jul 2012
    12 Apr 2012
    Link to this post
    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!
    Answered
2 posts, 1 answered