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?
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With