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);
}
The following code will solve the problem.
if (!web.IsRootWeb && !web.HasUniqueRoleDefinitions)
{
web.RoleDefinitions.BreakInheritance(true, false);
}
Comments
Post a Comment