Share via


Add Method

SPGroupCollection.Add Method

The Add method of the SPGroupCollection class adds a cross-site group to the collection of cross-site groups in a site collection.

Parameters

name   A string that contains the new cross-site group name.

owner   A Microsoft.SharePoint.SPMember object that specifies the owner. Only a user or a cross-site group, not a site group, can be the owner of a cross-site group.

defaultUser   A Microsoft.SharePoint.SPUser object that specifies the default user for the cross-site group.

description   A string that contains a description for the cross-site group.

Example

The following code example creates a cross-site group in the current site collection.

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