SPPermission Class

The SPPermission class represents the permission assigned to a user, site group, or cross-site group for a list or a site.

System.Object

   Microsoft.SharePoint.SPPermission

Public Methods

The following table shows the public methods of the SPPermission class and a brief description of each.

Name Description
ToString Returns the member ID of the user or site group for the permission object.

Public Properties

The following table shows the public properties of the SPPermission class, the data type of each property, and a brief description of each.

Name Data Type Description
Member Microsoft.SharePoint.SPMember Gets the member object for the user, site group, or cross-site group that has the permission.
Parent Object Gets the parent object for the specified permission object, which can be a list or a site.
PermissionMask Microsoft.SharePoint.SPRights Gets or sets the rights for the permission mask of the user, site group, or cross-site group.
Xml String Gets the permission object in XML format.

Thread Safety

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

Remarks

Use the Permissions property of either the SPList or SPWeb class to return an SPPermissionCollection object that represents the collection of permissions for a list or a site. Use an indexer to return a single permission from the collection. For example, if the collection is assigned to a variable named myPermissions, use myPermissions[index] in C#, or myPermissions(index) in Visual Basic .NET, where index is either the index number of the permission in the collection or the SPMember object for a user or site group that has the permission for the list or site.

A permission consists of a right or combination of rights as specified by the SPRights enumeration. The PermissionMask property contains the set of rights assigned to the user or group.

Example

The following code example uses the PermissionMask property of the SPPermission class to modify the permissions assigned to a single user.

This example requires using directives (Imports in Visual Basic) for both the Microsoft.SharePoint and Microsoft.SharePoint.WebControls namespaces.

Requirements

Namespace: Microsoft.SharePoint

Platforms: Microsoft Windows Server 2003

Assembly: Windows SharePoint Services (in Microsoft.SharePoint.dll)

Security: Code Access Security