The language criteria is not needed, otherwise I'm guessing the problem is in the listing control you use and/or publish status or permissions when you save pages inside the scheduled job.
Removed the criteria, also tried DataFactoryCache.Clear() prior to the FindPagesWithCriteria. Also tried FindAllPagesWithCriteria but that didn't work.
Also tried saving the pages with AccessLevel.NoAccess on the import job and also tried this:
http://world.episerver.com/Blogs/Magnus-Paulsson/Dates/2010/12/Run-a-scheduled-job-as-a-specific-role/
Nothing seems to work. If I create a new page in EPiServer (just a test page) under the year container the page isn't displayed. Using GetChildren on the container, then it works.
A bug perhaps? Or am I doing something completely wrong?
FPWC isn't cached, but what happens if you insert a break point in the scheduled job code and look at the result in the getPages variable - do you see the pages you're adding?
Also, I'd remove the page language criteria from the criteria collection.
Just curious, is HTTP caching enabled?
If i rerun the job with an empty Pressreleases page, the pages are displayed. If a new one comes in or if I try to create a page manually under there, it's not displayed anywhere so it seems to be a bug with the import after it's initial creation.
HTTP caching is not enabled.
But if you inspect the 'getPages' result variable after having added a page, do you see the newly created page in the result set?
Would probably be a good idea to try and narrow it down to see if the problem is in your FPWC call, the control(s) displaying the press releases or in your scheduled job... :/
Can't see it at the breakpoint! Just the latest created at the initial import. Strange
The manager class that handles the import
And the job itself
And again, the GetChildren class on the date container, returns the created pages.
Had to solve it by making a sibling extension method using GetChildren, i'm going to submit a bugreport to EPiServer tho :)
Ran into same problem in EPiServer 7.0. Solved by impersonating an admin user (specified in web.config) before running FindPagesWithCriteria, like this:
PrincipalInfo.CurrentPrincipal = PrincipalInfo.CreatePrincipal(ConfigurationManager.AppSettings["adminUser"]);
// FindPagesWithCriteria code
// Sets impersonation back to anonymous
PrincipalInfo.CurrentPrincipal = PrincipalInfo.AnonymousPrincipal;
Goran:
Is seems to me that you could use FindAllPagesWithCriteria equally well, and get the same result?
Do you agree?
Cheers
//Daniel
Hi Everyone,
Seem to have an issue with FindPagesWithCriteria.
I've built an scheduled job that imports pressreleases from Cision. Also importing them into date containers.
The job imports the pressreleases without any issues, but if a new one comes in it isn't displayed in the following function i've built for a simple PageList-function on the startpage