SPRoleDefinitionCollection.GetByType Method
Returns the role definition of the specified type from the collection.
Assembly: Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Available in Sandboxed Solutions: Yes
Available in SharePoint Online
[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.SPRoleType
An SPRoleType value that specifies the role type. An exception is thrown if you pass SPRoleType.None as an argument.
Return Value
Type: Microsoft.SharePoint.SPRoleDefinitionAn SPRoleDefinition object that represents the role definition.
| Exception | Condition |
|---|---|
| ArgumentException |
Either SPRoleType.None was passed as an argument or a definition with the specified role type was not found. |