Problems with ScheduledPlugIn and FindPagesWithCriteria

Tore Gjerdrum
Member since: 2006


I am having problems with FindPagesWithCritera in a Scheduled Job. I am importing news items from a xml feed. All news items from 2009 will be placed in an "folder page" with 2009 as the PageName.This "folder page" is created if it does not exist. The way I check this is by running FindPagesWith critera with an PropertyCriteria matching PageName against the year.

If I run the Scheduled Job with the "Start Manually" button in Admin mode, everything works fine. But when it is excecuted by the Scheduler service, the FindPagesWithCriteria always retuns 0 pages. Because of this the "folder page"is created for every imported news item.

I could of course use GetChildren or GetDescendents and there is no problem at all. But is this a bug in FindPagesWithCriteria?! I am running R2 on Vista with IIS 7.

Br, Tore

#28953 Mar 30, 2009 17:07
  • Per Gunsarfs
    Member since: 2005


    Could it be that the page(s) aren't readable for anonymous users? When the scheduled job is run schedueled it will be run as an anonymous user, and the FindPagesWithCriteria function will filter based on access right.

    We are aware of that the filtering may not always be appropriate, so we added a new method, FindAllPagesWithCritera, that will not filter away any pages. I think that method is included in the lates service pack for R2.


    Per Gunsarfs
    EPiServer CMS Development Team

    #28954 Mar 30, 2009 17:19
  • Tore Gjerdrum
    Member since: 2006

    Hi Per.

    Thanks for the answer! You are spot on. It is an Intranet, so the Everyone does not have read access to the site. But I thought FindPagesWithCriteria in R2 gave me all pages regardless of access rights. Because when I try to include access rights(AccessLevel.NoAccess), I get that the method is obsolete. "Use overload without access parameter. Access rights are ignored". Then this is not right, or what?!

    I will try to upgrade to R2 SP1 or use GetChildren. Thanks for your help :)

    Br, Tore

    #28956 Mar 30, 2009 17:50
  • Erik Nordin Wahlberg
    Member since: 2004

    I had the same problem running R2 with no SP

    Instead of upgrading or use GetChildren you can impersonate and run the job with a specified user. Read my blog post about it:


    #28957 Mar 30, 2009 22:08
  • Tore Gjerdrum
    Member since: 2006

    Hi Erik.

    Thanks for the tip. Will definitely look into it!

    Br, Tore

    #28969 Mar 31, 2009 8:26