Fluent API get page content

Posted by Community Admin on 04-Aug-2018 11:07

Fluent API get page content

All Replies

Posted by Community Admin on 11-Nov-2014 00:00

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

Posted by Community Admin on 12-Nov-2014 00:00

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
 

This thread is closed