Try our conversational search powered by Generative AI!

DataFactory.Instance.GetChildren() is not returning the latest created articles.

Vote:
 

GetChildren is not returning latest pages which created by editor.this code was working earlier. but now it does not.

Below is my code.


List<PageData> children = DataFactory.Instance.GetChildren(pageLink, LanguageSelector.AutoDetect(true)).Where(c => c.CheckPublishedStatus(PagePublishedStatus.Published)).OrderByDescending(x => x.StartPublish).ToList();

The problem i am facing is that, its returning old articles which we have created one week earlier. New articles are not returned.

And i am not sure if any episerver settings can be a problem?

#203099
Edited, Apr 09, 2019 11:52
Vote:
 

Which version of Episerver are you using?

#203100
Apr 09, 2019 12:08
Vote:
 

I am using 10.10.4 episerver version

#203101
Apr 09, 2019 12:14
Vote:
 

Have you checked that all your startpublish dates are correct on the settings of the pages and they have not changed at all. The code should work.

By using StartPublish you are bound to an internal property that may change. Usually we add a new property in specifically for users to be able to set the Article publish date independantly of the CMS publish date and default it to the current date.

Also as a note you shouldn't be using DataFactory.Instance.GetChildren at all for anything. You should be injecting in IContentLoader and using that, the DataFactory is legacy code.

#203102
Apr 09, 2019 12:26
* 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.