Share via


SPRoleDefinitionCollection.BreakInheritance Method

Breaks role definition inheritance and gives the current Web site its own copy of the role definitions.

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

Syntax

'Declaration
Public Sub BreakInheritance ( _
    CopyRoleDefinitions As Boolean, _
    KeepRoleAssignments As Boolean _
)
'Usage
Dim instance As SPRoleDefinitionCollection
Dim CopyRoleDefinitions As Boolean
Dim KeepRoleAssignments As Boolean

instance.BreakInheritance(CopyRoleDefinitions, _
    KeepRoleAssignments)
public void BreakInheritance(
    bool CopyRoleDefinitions,
    bool KeepRoleAssignments
)

Parameters

  • CopyRoleDefinitions
    Type: System.Boolean

    true to copy the role definitions of the parent Web site when breaking inheritance; false to use the default role definitions from the template.

  • KeepRoleAssignments
    Type: System.Boolean

    true to break role definition inheritance yet maintain role assignments; otherwise, false.

Remarks

Breaking role definition inheritance also breaks role assignment inheritance, which results in unique role assignments on the Web site. As a result, after this method is called the values of the HasUniqueRoleDefinitions property and the HasUniqueRoleAssignments property are both set to true.

If the Web site already has unique role definitions, this method returns without making any changes.

See Also

Reference

SPRoleDefinitionCollection Class

SPRoleDefinitionCollection Members

Microsoft.SharePoint Namespace

RoleDefinitions