Quantcast
Channel: Optimizely Search & Navigation
Viewing all articles
Browse latest Browse all 6894

How can I return all published pages with their page types in an EPiServer 8.0 site?

$
0
0

We'd like to return a list of all pages with their page types from an EPiServer 8.0 site.  Preferably I'd like to do this within a navigation structure via a list of ContentAreaItem objects. But I found an example that suggests the FindAllPagesWithCriteria method.  But I'm having difficulty creating the criteria object.

What we would like to see is everything that is published.  Below is what I have.  But it's unclear to me how to define the criteria as give us all the pages that are published.

var criteria = // What do I put here?
var queryService = ServiceLocator.Current.GetInstance<IPageCriteriaQueryService>();
var pages = queryService.FindAllPagesWithCriteria(PageReference.StartPage, criteria, "en", new LanguageSelector("en"));

The other (preferred) alternative is this: can I get the page type from a ContentAreaItem object?  I've got some navigation tree code that has an IList<ContentAreaItem> list of items.  If I can get the Page Type from a ContentAreaItem, it would be even better.

Thanks for your help.


Viewing all articles
Browse latest Browse all 6894

Trending Articles