SPRoleAssignmentCollection.Add method (SPRoleAssignment)
SharePoint 2013
Adds a role assignment to the collection of role assignment objects.
Assembly: Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Parameters
- roleAssignment
- Type: Microsoft.SharePoint.SPRoleAssignment
The role assignment to add.
This method fails if the collection already contains a role assignment for the security principal specified in the Member property of roleAssignment.
This method ensures that the security principal in the Member property of roleAssignment has at least SPRoleType.Guest access to objects in all parent scopes. To limit the access of the security principal to objects only in the current scope, call the AddToCurrentScopeOnly(SPRoleAssignment) method.