BreakRoleInheritance Method

Title: SPList.BreakRoleInheritance Method
Details: BreakRoleInheritance would break the inheritance ( can be used on a list / document library ) to alter permissions on the parent or itemlevel.
Usage:

public void BreakRoleInheritance (
bool CopyRoleAssignments
)

Accepts either true / false as parameter that would decide whether or not to copy the existing groups / users and permissions.

One interesting concept to note. Instead of using the below code that would remove all the groups and permissions from an item or list level after breaking the inheritance.


listItem.RoleAssignments.RemoveAll();


we can simple use as below


listItem.BreakRoleInheritance(false);

Comments