Getting published pages from API

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

Getting published pages from API

All Replies

Posted by Community Admin on 09-Sep-2011 00:00

I'm running into an issue getting published pages programmatically.  Currently, I'm using 

 IEnumerable<PageNode> pageNodes = parentNode.Nodes.Where(m => m.ShowInNavigation && (m.ApprovalWorkflowState == "Published" || m.ApprovalWorkflowState == "")).OrderBy(m => m.Ordinal);

which returns published pages but if a page was published but is now in Draft mode currently the page is not returned but it needs to be returned. Basically, I need to be able to get all "live" pages.

Posted by Community Admin on 13-Sep-2011 00:00

Hello Suzanne,

I have prepared a code sample for you which should get all pages you want:

public IQueryable<PageNode> GetLivePages()
           
               IQueryable<PageNode> pageNodes = App.WorkWith()
                                                   .Pages()
                                                   .LocatedIn(Telerik.Sitefinity.Fluent.Pages.PageLocation.Frontend)
                                                   .Where(pN => pN.ApprovalWorkflowState == "Published")
                                                   .ThatArePublished()
                                                   .Where(pN => (pN.Page.Status == ContentLifecycleStatus.Temp && pN.Page.Version > 0&& pN.Page.Visible == true)|| pN.Page.Status == ContentLifecycleStatus.Live )
                                                   .OrderBy(pN => pN.Ordinal)
                                                   .Get();
               return pageNodes;
           

Regards,
Victor Velev
the Telerik team
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 Public Issue Tracking system and vote to affect the priority of the items

This thread is closed