Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Returns the role definition of the specified type 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 := "0", ErrorType := GetType(ArgumentException), _
Condition := "Specified role type is None or no role with this type was found in the collection.")> _
Public Function GetByType ( _
roleType As SPRoleType _
) As SPRoleDefinition
'Usage
Dim instance As SPRoleDefinitionCollection
Dim roleType As SPRoleType
Dim returnValue As SPRoleDefinition
returnValue = instance.GetByType(roleType)
[ClientCallableMethodAttribute(CacheReturnValue = true, ReturnObjectIdentity = true)]
[ClientCallableExceptionConstraintAttribute(FixedId = "0", ErrorType = typeof(ArgumentException),
Condition = "Specified role type is None or no role with this type was found in the collection.")]
public SPRoleDefinition GetByType(
SPRoleType roleType
)
Parameters
roleType
Type: Microsoft.SharePoint.SPRoleTypeAn SPRoleType value that specifies the role type. An exception is thrown if you pass SPRoleType.None as an argument.
Return Value
Type: Microsoft.SharePoint.SPRoleDefinition
An SPRoleDefinition object that represents the role definition.
Exceptions
| Exception | Condition |
|---|---|
| ArgumentException | Either SPRoleType.None was passed as an argument or a definition with the specified role type was not found. |
Remarks
A role definition collection can contain only one role definition for each SPRoleType.
See Also
Reference
SPRoleDefinitionCollection Class