UserGroup.AddGroup Method

Adds a group to the current site collection.

Namespace:  websvcUsersGroups
Assembly:  STSSOAP (in STSSOAP.dll)

Syntax

'Declaration
<SoapDocumentMethodAttribute("https://schemas.microsoft.com/sharepoint/soap/directory/AddGroup", RequestNamespace := "https://schemas.microsoft.com/sharepoint/soap/directory/",  _
    ResponseNamespace := "https://schemas.microsoft.com/sharepoint/soap/directory/",  _
    Use := SoapBindingUse.Literal, ParameterStyle := SoapParameterStyle.Wrapped)> _
Public Sub AddGroup ( _
    groupName As String, _
    ownerIdentifier As String, _
    ownerType As String, _
    defaultUserLoginName As String, _
    description As String _
)
'Usage
Dim instance As UserGroup
Dim groupName As String
Dim ownerIdentifier As String
Dim ownerType As String
Dim defaultUserLoginName As String
Dim description As String

instance.AddGroup(groupName, ownerIdentifier, _
    ownerType, defaultUserLoginName, _
    description)
[SoapDocumentMethodAttribute("https://schemas.microsoft.com/sharepoint/soap/directory/AddGroup", RequestNamespace = "https://schemas.microsoft.com/sharepoint/soap/directory/", 
    ResponseNamespace = "https://schemas.microsoft.com/sharepoint/soap/directory/", 
    Use = SoapBindingUse.Literal, ParameterStyle = SoapParameterStyle.Wrapped)]
public void AddGroup(
    string groupName,
    string ownerIdentifier,
    string ownerType,
    string defaultUserLoginName,
    string description
)

Parameters

  • groupName
    Type: System.String
    A string that contains the name of the new group.
  • ownerIdentifier
    Type: System.String
    A string that contains the user name (DOMAIN\User_Alias) of the owner for the group.
  • ownerType
    Type: System.String
    A string that specifies the type of owner, which can be either user or group.
  • defaultUserLoginName
    Type: System.String
    A string that contains the user name (DOMAIN\User_Alias) of the default user for the group.
  • description
    Type: System.String
    A string that contains a description of the group.

Remarks

Adding a group to a Web site also adds the group to the parent site collection.

Examples

The following code example adds a new group to the current site collection.

Dim usrgrpService As New Web_Reference_Folder_Name.UserGroup()
usrgrpService.Credentials = System.Net.CredentialCache.DefaultCredentials

usrgrpService.AddGroup("Group_Name", "DOMAIN\Owner_Alias", "user", "DOMAIN\User_Alias", "Description")
Web_Reference_Folder_Name.UserGroup usrgrpService = new Web_Reference_Folder_Name.UserGroup();
usrgrpService.Credentials= System.Net.CredentialCache.DefaultCredentials;

usrgrpService.AddGroup("Group_Name", "DOMAIN\\Owner_Alias", "user", "DOMAIN\\User_Alias", "Description");

See Also

Reference

UserGroup Class

UserGroup Members

websvcUsersGroups Namespace