次の方法で共有


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

'Declaration
<ObsoleteAttribute("Use the SPRoleAssignment class instead")> _
Public Property PermissionMask As SPRights
    Get
    Set
'Usage
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 Disposing Objects.

See also

Reference

SPPermission class

SPPermission members

Microsoft.SharePoint namespace