EPiServer CMS 9 and published pages



Im using EpiServer CMS 9 and trying to get all published pages using this line of code.

     EPiServer.Filters.FilterPublished.CheckPublishedStatus(content, PagePublishedStatus.Published)

However I'm getting an error saying that FilterPublished does not contain a definition for CheckPublishedStatus.

My Question:
How do I get the published pages only.
Please use above line of code when providing an answer.


Dec 01, 2015 10:18

You can try something like this:

var contentLoader = ServiceLocator.Current.GetInstance<IContentLoader>();
var startPage = contentLoader.Get<StartPage>(ContentReference.StartPage);
var published = contentLoader.GetChildren<PageData>(startPage.ContentLink)
                                // skip container pages
                                .Filter(new FilterTemplate())
                                // skip unpublished pages
                                .Filter(new FilterPublished())
                                // ...
Dec 01, 2015 13:36
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.