SPSecurableObject.BreakRoleInheritance Method (Boolean, Boolean)

Creates unique role assignments for the object, optionally copies role assignments from the parent, and optionally clears unique role assignments from descendants.

Namespace:  Microsoft.SharePoint
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Available in Sandboxed Solutions: Yes
Available in SharePoint Online

Syntax

'Declaration
<ClientCallableExceptionConstraintAttribute(FixedId := "SPException$-2146232832", ErrorType := GetType(SPException),  _
    Condition := "This securable object is a site and it is the top level site.",  _
    ErrorCode := )> _
<ClientCallableAttribute> _
<ClientCallableExceptionConstraintAttribute(FixedId := "System.InvalidOperationException$0",  _
    ErrorType := GetType(InvalidOperationException), Condition := "There are uncommitted changes for this securable object when this method is called.",  _
    ErrorCode := )> _
<ClientCallableExceptionConstraintAttribute(FixedId := "4", Condition := "The current user does not have the ‘Manage Permissions’ permission on this securable object.",  _
    ErrorType := GetType(UnauthorizedAccessException))> _
Public Overridable Sub BreakRoleInheritance ( _
    copyRoleAssignments As Boolean, _
    clearSubscopes As Boolean _
)
'Usage
Dim instance As SPSecurableObject
Dim copyRoleAssignments As Boolean
Dim clearSubscopes As Boolean

instance.BreakRoleInheritance(copyRoleAssignments, _
    clearSubscopes)
[ClientCallableExceptionConstraintAttribute(FixedId = "SPException$-2146232832", ErrorType = typeof(SPException), 
    Condition = "This securable object is a site and it is the top level site.", 
    ErrorCode = )]
[ClientCallableAttribute]
[ClientCallableExceptionConstraintAttribute(FixedId = "System.InvalidOperationException$0", ErrorType = typeof(InvalidOperationException), 
    Condition = "There are uncommitted changes for this securable object when this method is called.", 
    ErrorCode = )]
[ClientCallableExceptionConstraintAttribute(FixedId = "4", Condition = "The current user does not have the ‘Manage Permissions’ permission on this securable object.", 
    ErrorType = typeof(UnauthorizedAccessException))]
public virtual void BreakRoleInheritance(
    bool copyRoleAssignments,
    bool clearSubscopes
)

Parameters

  • copyRoleAssignments
    Type: System.Boolean

    true to copy the role assignments from the parent object to this object; false to assign only the current user to security roles.

  • clearSubscopes
    Type: System.Boolean

    true to clear the unique role assignments from child objects, which in turn inherit role assignments from this object; false to keep the unique role assignments defined on child objects in place.

Remarks

This method replaces the default role assignments that the securable object inherits from its parent object with unique role assignments.

See Also

Reference

SPSecurableObject Class

SPSecurableObject Members

BreakRoleInheritance Overload

Microsoft.SharePoint Namespace

ResetRoleInheritance()