More in this section
Forums / Developing with Sitefinity / Getting published pages from API

Getting published pages from API

The forums are in read-only mode. In case that you want to directly contact the Progress Sitefinity team use the support center. In our Google Plus group you can find more than one thousand Sitefinity developers discussing different topics. For the Stack Overflow threads don’t forget to use the “Sitefinity” tag.
2 posts, 0 answered
  1. Suzanne
    Suzanne avatar
    43 posts
    12 Jul 2012
    09 Sep 2011
    Link to this post
    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.
  2. Victor Velev
    Victor Velev avatar
    1345 posts
    06 Jul 2015
    13 Sep 2011
    Link to this post
    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()
                                                       .Where(pN => pN.ApprovalWorkflowState == "Published")
                                                       .Where(pN => (pN.Page.Status == ContentLifecycleStatus.Temp && pN.Page.Version > 0&& pN.Page.Visible == true)|| pN.Page.Status == ContentLifecycleStatus.Live )
                                                       .OrderBy(pN => pN.Ordinal)
                   return pageNodes;

    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
2 posts, 0 answered