Share via


SPRoleDefinitionCollection.DeleteById method

Deletes the role definition with the specified ID from the collection.

Namespace:  Microsoft.SharePoint
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)

Syntax

'Declaration
Public Sub DeleteById ( _
    id As Integer _
)
'Usage
Dim instance As SPRoleDefinitionCollection
Dim id As Integer

instance.DeleteById(id)
public void DeleteById(
    int id
)

Parameters

  • id
    Type: System.Int32

    A 32-bit integer that specifies the ID. The argument should be the value of the Id property of the role definition that you want to delete.

Exceptions

Exception Condition
ArgumentException

The role definition of the current website is not inherited from the parent website.

-or-

The current website does not have the unique role definition.

-or-

The role definition specified by the id parameter does not exist in the collection.

SPException

The type of the role definition that specified the id parameter is guest or administrator.

Remarks

The DeleteById method unbinds and destroys the data of the role definition, deleting all role assignment bindings for the definition. For example, if the roles Contribute and Author have been assigned to a user and the Author role definition is deleted, the user will have only the Contribute role.

See also

Reference

SPRoleDefinitionCollection class

SPRoleDefinitionCollection members

Microsoft.SharePoint namespace