Five New Optimizely Certifications are Here! Validate your expertise and advance your career with our latest certification exams. Click here to find out more
AI OnAI Off
Five New Optimizely Certifications are Here! Validate your expertise and advance your career with our latest certification exams. Click here to find out more
One way to solve this is to using GetChildren but with the language selector. This method only returns the published pages. When we use the Language selector we have all the pages.
Example:
articlePages = this._contentRepository.GetChildren<ArticlePage>( articleFolder.ContentLink, LanguageSelector.AutoDetect(true)).ToArray();
Thank you
If you want to use FindPagesWithCriteria or similar you can use "FindAllPagesWithCriteria" which also requires a language to be defined:
var queryService = ServiceLocator.Current.GetInstance<IPageCriteriaQueryService>(); var pages = queryService.FindAllPagesWithCriteria(PageReference.StartPage, criteria, "en", new LanguageSelector("en"));
Just as a word of caution - FindPagesWithCriteria isn't the most efficient of methods as it calls the database directly, bypassing the cache so I'd consider my options before using it on the public facing part of your site.
You could use EPiServer.Core.IContent.IContentModelUsage.ListContentOfContentType(ContentType contentType).
Hi,
I'm trying to get all the pages of a particular type existing in the episerver tree. The problem is I only get the published pages. Not the ones that are in draft mode. I'm already use two techniques to get the pages:
and
Can you help me please?