SPPermissionCollection.Add method
NOTE: This API is now obsolete.
Cria um objeto de permissão com o membro especificado e permissões da coleção.
Namespace: Microsoft.SharePoint
Assembly: Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Syntax
'Declaração
<ObsoleteAttribute("Use the SPRoleAssignmentCollection class instead")> _
Public Sub Add ( _
member As SPMember, _
permissionMask As SPRights _
)
'Uso
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
)
Parâmetros
member
Type: Microsoft.SharePoint.SPMemberUm objeto Member que representa o membro.
permissionMask
Type: Microsoft.SharePoint.SPRightsUm valor de SPRights que especifica as permissões.
Examples
O exemplo de código a seguir modifica as permissões de um grupo para a lista de avisos do site atual.
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);