PermissionMask Property
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here. ArchiveDisclaimer

SPPermission.PermissionMask Property

Windows SharePoint Services 3

NOTE: This API is now obsolete.

Gets or sets the rights for the permission mask of the user or group.

Namespace:  Microsoft.SharePoint
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)

[ObsoleteAttribute("Use the SPRoleAssignment class instead")]
public SPRights PermissionMask { get; set; }

Property Value

Type: Microsoft.SharePoint.SPRights
An SPRights value that specifies the rights.

To define a permission mask that consists of multiple rights, use the pipe symbol ("|") in Microsoft Visual C# or Or in Microsoft Visual Basic to delimit the rights.

The following code example modifies the permission mask for a group, giving it the rights to manage lists and to manage the permissions for lists.

SPSite oSiteCollection = SPContext.Current.Site;
using(SPWeb oWebsite = oSiteCollection.AllWebs["Site_Name"])
    SPMember oMember = oWebsite.Roles["Role_Name"];
    oWebsite.Permissions[oMember].PermissionMask = 
        SPRights.ManageLists | SPRights.ManageListPermissions;

Certain objects implement the IDisposable interface, and you must avoid retaining these objects in memory after they are no longer needed. For information about good coding practices, see Best Practices: Using Disposable Windows SharePoint Services Objects.

© 2015 Microsoft