When I was using the contributor account to check the content-type folder is "message" or "Dicussion", I got an error: "Access denied!"
My code:
if (ctype.ResourceFolder.Name == "Message")
{
//do something
}
But nothing happened with owner account.
Yes, because contributor account can not access to ResourceFolder properties of content-type. ResourceFolder was inherited from SPFolder and execute the method FolderEnsure. You know to give the access to folder ensure the account must be set the properties currentWeb.AllowUnsafeUpdates = true; and the default for member account does not have permission to run that update.
You can change the code to look like this:
if (ctype.Id == SPBuiltInContentTypeId.Message)
{
//do something
}
The result is nearly the same.
No comments:
Post a Comment