You cannot customize permission levels in a web site with inherited permission levels. at Microsoft.SharePoint.SPRoleDefinitionCollection.Add(SPRoleDefinition role)

Okay simple solution here: Make sure that if you are not the root SPWeb and you want to add custom role definitions i.e. SPRoleDefinitions call SPRoleDefinitionCollection.BreakInheritance(bool,bool)

if (!web.IsRootWeb && !web.HasUniqueRoleDefinitions)
{
      web.RoleDefinitions.BreakInheritance(true, false);
}
Advertisements
Tagged ,

One thought on “You cannot customize permission levels in a web site with inherited permission levels. at Microsoft.SharePoint.SPRoleDefinitionCollection.Add(SPRoleDefinition role)

  1. K. Feroz says:

    Thanks a lot… you wont beleive your code snippet has helped me a lot with just a click.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: