Sdílet prostřednictvím


SPRoleAssignmentCollection Class

Represents a collection of role assignments for a securable object.

Inheritance Hierarchy

System.Object
  Microsoft.SharePoint.Administration.SPAutoSerializingObject
    Microsoft.SharePoint.SPBaseCollection
      Microsoft.SharePoint.SPRoleAssignmentCollection

Namespace:  Microsoft.SharePoint
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Available in Sandboxed Solutions: Yes
Available in SharePoint Online

Syntax

'Declaration
<ClientCallableTypeAttribute(Name := "RoleAssignmentCollection", ServerTypeId := "{2690207a-e174-4d49-b2ca-cff663225dc1}",  _
    CollectionChildItemType := GetType(SPRoleAssignment))> _
<SubsetCallableTypeAttribute> _
Public NotInheritable Class SPRoleAssignmentCollection _
    Inherits SPBaseCollection
'Usage
Dim instance As SPRoleAssignmentCollection
[ClientCallableTypeAttribute(Name = "RoleAssignmentCollection", ServerTypeId = "{2690207a-e174-4d49-b2ca-cff663225dc1}", 
    CollectionChildItemType = typeof(SPRoleAssignment))]
[SubsetCallableTypeAttribute]
public sealed class SPRoleAssignmentCollection : SPBaseCollection

Remarks

Use the RoleAssignments property of the SPPermissionInfo, SPSecurableObject, SPList, SPListItem, or SPWeb class, to return the collection of role assignments for the given object.

To create a role assignment that has no role definition bindings, use an SPRoleAssignment constructor. To add bound role definitions to a role assignment, use the ImportRoleDefinitionBindings method. Use the Add method of the SPRoleAssignmentCollection class to add a role assignment to the collection of role assignments for the object.

Use an indexer to return a single item from the collection. For example, if the collection is assigned to a variable named myRoleAssignments, use myRoleAssignments[index] in C# or myRoleAssignments(index) in Visual Basic, where index is either the index number of the item in the collection or a string containing the name of the role definition.

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also

Reference

SPRoleAssignmentCollection Members

Microsoft.SharePoint Namespace