Partilhar via


SPPolicyRoleCollection Class

Represents a collection of SPPolicyRole objects.

Inheritance Hierarchy

System.Object
  Microsoft.SharePoint.Administration.SPAutoSerializingObject
    Microsoft.SharePoint.Administration.SPPolicyRoleCollection

Namespace:  Microsoft.SharePoint.Administration
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Available in Sandboxed Solutions: No

Syntax

'Declaration
<SharePointPermissionAttribute(SecurityAction.InheritanceDemand, ObjectModel := True)> _
<SharePointPermissionAttribute(SecurityAction.LinkDemand, ObjectModel := True)> _
Public NotInheritable Class SPPolicyRoleCollection _
    Inherits SPAutoSerializingObject _
    Implements IEnumerable
'Usage
Dim instance As SPPolicyRoleCollection
[SharePointPermissionAttribute(SecurityAction.InheritanceDemand, ObjectModel = true)]
[SharePointPermissionAttribute(SecurityAction.LinkDemand, ObjectModel = true)]
public sealed class SPPolicyRoleCollection : SPAutoSerializingObject, 
    IEnumerable

Remarks

Use the PolicyRoles property of the SPWebApplication class to return the collection of policy roles for the Web application. To create a policy role in the collection, use the Add method.

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

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

SPPolicyRoleCollection Members

Microsoft.SharePoint.Administration Namespace