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

Forums / Developing with Sitefinity / Fluent API get page content

Fluent API get page content

2 posts, 0 answered
  1. Jens
    Jens avatar
    6 posts
    Registered:
    04 Mar 2014
    11 Nov 2014
    Link to this post

    Hello,

     I want to get the content of a frond end page with the Fluent API but I don't 
    see a property content or something like that. Question How do I get the content
    and widgets through the API?

    Greetings,
    Jens

  2. Miroslava
    Miroslava avatar
    57 posts
    Registered:
    22 Feb 2016
    12 Nov 2014
    Link to this post
    Hello Jens,

    Thank you for contacting us.

    Here is a link to our Sitefinity documentation on Querying pages with Native and Fluent API:
    http://www.sitefinity.com/documentation/documentationarticles/developers-guide/sitefinity-essentials/pages/querying-pages

    We have provided samples for Finding a page data by node ID, Finding a page data by title, Finding a page data by URL of the node. All of these method return PageData object. You can access all widgets on a page by retrieving Controls property of PageData object.

    To retrieve and work with frontend pages only, in the given documentation examples you should use LocatedIn facade:
    public PageData FindPageByTitleFluentAPI(string pageTitle)
            {
                PageData pageData = null;
     
                var count = 0;
                App.WorkWith().Pages().LocatedIn(Telerik.Sitefinity.Fluent.Pages.PageLocation.Frontend).Where(pN => (pN.Page != null && pN.Page.Title == pageTitle)).Count(out count);
     
                if (count != 0)
                {
                    pageData = App.WorkWith().Pages().LocatedIn(Telerik.Sitefinity.Fluent.Pages.PageLocation.Frontend).Where(pN => (pN.Page != null && pN.Page.Title == pageTitle)).Get().First().Page;
                }
     
                return pageData;
            }


    Regards,
    Miroslava
    Telerik
     
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
     
2 posts, 0 answered