Partilhar via


SPRoleDefinitionCollection.GetById Method

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

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

Syntax

'Declaration
<ClientCallableMethodAttribute(CacheReturnValue := True, ReturnObjectIdentity := True)> _
<ClientCallableExceptionConstraintAttribute(FixedId := "System.ArgumentException$1", ErrorType := GetType(ArgumentException),  _
    ErrorCode := , Condition := "The role definition does not exist in the collection at the given scope")> _
Public Function GetById ( _
    id As Integer _
) As SPRoleDefinition
'Usage
Dim instance As SPRoleDefinitionCollection
Dim id As Integer
Dim returnValue As SPRoleDefinition

returnValue = instance.GetById(id)
[ClientCallableMethodAttribute(CacheReturnValue = true, ReturnObjectIdentity = true)]
[ClientCallableExceptionConstraintAttribute(FixedId = "System.ArgumentException$1", ErrorType = typeof(ArgumentException), 
    ErrorCode = , Condition = "The role definition does not exist in the collection at the given scope")]
public SPRoleDefinition GetById(
    int id
)

Parameters

  • id
    Type: System.Int32

    A 32-bit integer that specifies the ID. The value of the ID does not correspond to the index of the role definition within the collection.

Return Value

Type: Microsoft.SharePoint.SPRoleDefinition
An SPRoleDefinition object that represents the role definition.

See Also

Reference

SPRoleDefinitionCollection Class

SPRoleDefinitionCollection Members

Microsoft.SharePoint Namespace