Freigeben über


SPPermissionCollection.Add-Methode

HINWEIS: Diese API ist veraltet.

Erstellt ein Permission-Objekt mit dem angegebenen Element und Berechtigungen in der Auflistung.

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

Syntax

'Declaration
<ObsoleteAttribute("Use the SPRoleAssignmentCollection class instead")> _
Public Sub Add ( _
    member As SPMember, _
    permissionMask As SPRights _
)
'Usage
Dim instance As SPPermissionCollection
Dim member As SPMember
Dim permissionMask As SPRights

instance.Add(member, permissionMask)
[ObsoleteAttribute("Use the SPRoleAssignmentCollection class instead")]
public void Add(
    SPMember member,
    SPRights permissionMask
)

Parameter

Beispiele

Das folgende Codebeispiel ändert die Berechtigungen einer Gruppe für die Ankündigungsliste der aktuellen Website.

Dim site As SPWeb = SPContext.Current.Web
Dim destList As SPList = site.Lists("Announcements")
Dim destPermissions As SPPermissionCollection = destList.Permissions
Dim member As SPMember = site.SiteGroups("Group_Name")

destPermissions.Add(member, SPRights.EditListItems Or 
    SPRights.ViewListItems)
SPWeb oWebsite = SPContext.Current.Web;
SPList oList = oWebsite.Lists["Announcements"];
SPPermissionCollection collPermissions = oList.Permissions;
SPMember oMember = oWebsite.SiteGroups["Group_Name"];

collPermissions.Add(oMember, SPRights.EditListItems | 
    SPRights.ViewListItems);

Siehe auch

Referenz

SPPermissionCollection Klasse

SPPermissionCollection-Member

Microsoft.SharePoint-Namespace