Difference between true and false when using BreakRoleInheritance() in SharePoint

14,836

Solution 1

As stated in the documentation, it's a boolean that states whether or not the role assignments are copied from the parent to the child. If false, the child will have a blank slate (other than owner) for roles. If true, it'll have whatever the parent has at the time you call the method.

Solution 2

From MSDN:

You can break the security inheritance of a Web site, list, or list item through the BreakRoleInheritance method of the object so that role assignments on the parent object no longer apply to the child object, for example, so that role assignments on a list no longer apply to a list item. For Web sites and lists, this method passes two Boolean parameters, copyRoleAssignments and clearSubScopes. The first parameter specifies whether to maintain the current role assignments already inherited from the parent site collection or Web site, and the second parameter specifies whether to clear unique permissions of child objects so that they will subsequently inherit permissions from the parent Web site or list. If the copyRoleAssignments parameter is set to false, the current user who runs the code acquires full control of the object.

Share:
14,836
carruw
Author by

carruw

Updated on June 19, 2022

Comments

  • carruw
    carruw almost 2 years

    What is the difference between using ListItem.BreakRoleInheritance(true) and ListItem.BreakRoleInheritance(false)?

    I get the same result when using these two and I'm wondering what tells them apart?

  • carruw
    carruw about 12 years
    Thank you for the clarifying answer. Much appreciated.