You cannot customize permission levels in a web site with inherited permission levels

The resolution to the problem is in the error message - the SPWeb has inherited permission levels that need to be overridden.

The following code will solve the problem.

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

Comments

Popular posts from this blog

SharePoint 2013: Error updating managed account credentials

Error deploying Nintex workflow: An item with the same key has already been added