0

Do I need Read access to an item if I need codebehind to get that item programatically?

Sitecore.Context.Database.GetItem(ID) will return null if I don't put read access on the item.

My code worked before upgrade from sitecore 7.2 to 8.2.

Can anyone confirm that you need read access to the item you want to get since a release after 7.2?

If not, any idea why it worked on Sitecore 7.2?

1
  • 1
    Yes, you need read access to use GetItem method. It may be set directly or inherited from one of the ancestors. It works exactly the same in 7.2. Maybe you lost some access rights configuration during upgrade?
    – Marek Musielak
    Commented May 11, 2017 at 14:22

1 Answer 1

4

Calls through the Sitecore API will take the security settings into account so you'll need to have read access to the item.

You can get around this by using the SecurityDisabler

using(Sitecore.SecurityModel.SecurityDisabler()){
  Sitecore.Context.Database.GetItem(ID)
  ...
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.