Partilhar via


GroupCollection.Add Method

Adds a group to the collection of groups in a site collection.

Namespace:  Microsoft.SharePoint.Client
Assemblies:   Microsoft.SharePoint.Client.Silverlight (in Microsoft.SharePoint.Client.Silverlight.dll);  Microsoft.SharePoint.Client (in Microsoft.SharePoint.Client.dll)

Syntax

'Declaration
<RemoteAttribute> _
Public Function Add ( _
    parameters As GroupCreationInformation _
) As Group
'Usage
Dim instance As GroupCollection
Dim parameters As GroupCreationInformation
Dim returnValue As Group

returnValue = instance.Add(parameters)
[RemoteAttribute]
public Group Add(
    GroupCreationInformation parameters
)

Parameters

Return Value

Type: Microsoft.SharePoint.Client.Group
A Group object that represents the newly-added group.

Exceptions

Exception Condition
SPException

The group description exceeds the maximum length. Error code: -2146232832. The group collection type is not a site-level group collection. Error code: -2146232832. The group owner is a role. Error code: -2146232832. The group owner is a domain group. Error code: -2146232832. The group collection is read-only. Error code: -2146232832. The group owner is a null reference (Nothing in Visual Basic). Error code: -2130575293. The group name is empty or exceeds the maximum length. Error code: -2130575281. The default user is a non a null reference (Nothing in Visual Basic) domain group. Error code: -2130575274. The group quota has exceeded. Error code: -2130575260. Another group with the same name is being added. Error code: -2130575169.

ArgumentException

The group owner is a null reference (Nothing in Visual Basic). Error code: -2147024809.

ArgumentNullException

The group to be added is a null reference (Nothing in Visual Basic). Error code: -2147467261.

UnauthorizedAccessException

The group description exceeds the maximum length. Error code: -2147024891.

See Also

Reference

GroupCollection Class

GroupCollection Members

Microsoft.SharePoint.Client Namespace