EPiServer: Get unpublished children too

October 29, 2010 EPiServer C# Snippet
DataFactory.Instance.GetChildren(myPageLink) only returns the children which are published. If you also want to get the pages that aren't yet published you should use the LanguageSelector-parameter which utilizes language fallback to return all children published or not. It doesn't matter if your EPiServer site is in one language only, the following will return published and unpublished children:
PageDataCollection children = DataFactory.Instance.GetChildren(myPageLink, LanguageSelector.AutoDetect(true));

Related posts: