Getting published pages from API
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);
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;