Add Method

The Add method of the SPRoleCollection class creates a site group object with the specified name, description, and permission mask in the collection.

Parameters

name   A string that contains the name of the site group.

description   A string that contains the description of the site group.

permissionMask   A Microsoft.SharePoint.SPRights value that specifies rights for the permission mask.

Remarks

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

Example

The following code example adds a site group that has permissions to manage both the site and its subsites.

This example requires using directives (Imports in Visual Basic) for both the Microsoft.SharePoint and Microsoft.SharePoint.WebControls namespaces.

Requirements

Platforms: Microsoft Windows Server 2003

Security: Code Access Security