This topic has not yet been rated - Rate this topic

SPRoleDefinitionCollection.GetByType Method

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
[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.SPRoleDefinition
An 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.

A role definition collection can contain only one role definition for each SPRoleType.

Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ