I have a script that goes through the tree starting at a certain node to find all items of a specified language version not in a publish workflow state and switch them over to the publish state. problem is when finding items from the master database it seems to not be able to find items that aren't in a publish state.

for example:

  • item A workflow state = publish, script runs and finds the item no problem
  • item B Workflow state = draft, script runs and can't find item B.

This holds true if I switch the workflow state of item A to Draft. master DB can't find it anymore


masterdb.GetItem("item path or id both don't work on draft items")
  • 1
    What site context is your script running in? Put your code in a using block; using(new SiteContextSwitcher(SiteContext.GetSite("shell"))) to ensure you're running in context of a site that does not filter non-final state workflow items. – Mark Cassidy Jun 3 '19 at 22:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.