November Happy Hour will be moved to Thursday December 5th.
AI OnAI Off
November Happy Hour will be moved to Thursday December 5th.
Correct examplecode:
var parentPage = ...; var pageList = _contentRepository.GetChildren<mypagetype>(parentPage, CultureInfo.InvariantCulture); return pageList.Where(x => x.CheckPublishedStatus(PagePublishedStatus.Published));
Yup adding culture can be necessary on scheduled job sometimes. Also remember that if you run it automatically you are fetching pages as anonymous user by default. So running a job manually usually works but automatically fails because of that reason...
My Solution is running on latest version of EPiserver CMS 8, multi-language environment.
GetChildren works nicely on my webpages as expected, but when I try to run GetChildren within scheduled task it was not loading any child on my test environment.
After testing a lot I found that if the page is not translated to the master-language it is not loaded in the scheduled task context with GetChildren. Maybe a bug?
I needed to get the page also if it is not translated. My solution was to add the CultureInfo.InvariantCulture to the getchildren function and filter out everything else than the published sites.
If any have a better solution please add a note.
Example code