Wednesday, July 21, 2010

Access Denied and Content type - who changed PermMask ?

Hello,

I wrote about this issue a while ago , and back then I came across with some hotfix tha was released from MS.

Since I saw this error again a few weeks ago, and I tried to fix it with this small utility - It brought me to the conclusion that their solution is not good enough.

Why ? several reasons -

1. It fix only one list, so you can of course iterate via all lists in the sites. But it still won’t solve the issue for new lists in that siteCollection.
2. It doesn't solve the damage that was done in the site collection level.
3. Through their code , you can't really understand how it connects to content type at all.

So what really happened then ?

By editing the list or the site with some editor, the content type that represent the permission mask in any list/doclib might have damaged. That content type is being reproduced itself in any list, so any new lists in a infected site, will be with this error as well.

So how do you really fix it ? After fixing the all the infected lists, by fixing their schema ( adding the missing attribute ), you need to fix that content type in the site collection level. How to do that - fix the content type in SPSite.RootWeb.

To sum things up, each content type has a definition which include the fields of that content type.

one of the fields is missing and you already know what to add ( check the code in my older post ) - that simple, but thats not documented.

Hope now you know what you need to fix when you get an Access denied on every item when you try to edit it !

Good Luck!