SPRoleAssignmentCollection.GetAssignmentByPrincipal Method
Gets the role assignment object based on the specified user or group.
Assembly: Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Available in Sandboxed Solutions: Yes
Available in SharePoint Online
[ClientCallableExceptionConstraintAttribute(FixedId = "System.ArgumentException$0", ErrorType = typeof(ArgumentException), ErrorCode = , Condition = "The user or group does not exist in the collection at the given scope")] [ClientCallableMethodAttribute(Name = "GetByPrincipal", ReturnObjectIdentity = true)] [ClientCallableExceptionConstraintAttribute(FixedId = "System.UnauthorizedAccessException$-2147024891", ErrorType = typeof(UnauthorizedAccessException), Condition = "")] public SPRoleAssignment GetAssignmentByPrincipal( SPPrincipal principalToFind )
Parameters
- principalToFind
- Type: Microsoft.SharePoint.SPPrincipal
The user or group.
Return Value
Type: Microsoft.SharePoint.SPRoleAssignmentThe role assignment for the specified user or group.
| Exception | Condition |
|---|---|
| ArgumentNullException |
principalToFind is null. |