Tuesday, 20 August 2013

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);
}

No comments:

Post a comment