Share via


SPPermission.PermissionMask Property

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)

Syntax

<ObsoleteAttribute("Use the SPRoleAssignment class instead")> _
Public Property PermissionMask As SPRights
    Get
    Set

Dim instance As SPPermission
Dim value As SPRights

value = instance.PermissionMask

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

Property Value

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

Remarks

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.

Examples

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.

Dim siteCollection As SPSite = SPContext.Current.Site
Dim site As SPWeb = siteCollection.AllWebs("Site_Name")
Dim member As SPMember = site.Roles("Role_Name")

site.Permissions(member).PermissionMask = 
    SPRights.ManageLists Or SPRights.ManageListPermissions 
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;
}

Note

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.

See Also

Reference

SPPermission Class

SPPermission Members

Microsoft.SharePoint Namespace