다음을 통해 공유


UserGroup.AddUserToGroup Method

Adds the user to the specified group.

Namespace:  [UserGroup Web service]
Web service reference: http://Site/_vti_bin/UserGroup.asmx

Syntax

'Declaration
<SoapDocumentMethodAttribute("https://schemas.microsoft.com/sharepoint/soap/directory/AddUserToGroup", RequestNamespace := "https://schemas.microsoft.com/sharepoint/soap/directory/",  _
    ResponseNamespace := "https://schemas.microsoft.com/sharepoint/soap/directory/",  _
    Use := SoapBindingUse.Literal, ParameterStyle := SoapParameterStyle.Wrapped)> _
Public Sub AddUserToGroup ( _
    groupName As String, _
    userName As String, _
    userLoginName As String, _
    userEmail As String, _
    userNotes As String _
)
'Usage
Dim instance As UserGroup
Dim groupName As String
Dim userName As String
Dim userLoginName As String
Dim userEmail As String
Dim userNotes As String

instance.AddUserToGroup(groupName, userName, _
    userLoginName, userEmail, userNotes)
[SoapDocumentMethodAttribute("https://schemas.microsoft.com/sharepoint/soap/directory/AddUserToGroup", RequestNamespace = "https://schemas.microsoft.com/sharepoint/soap/directory/", 
    ResponseNamespace = "https://schemas.microsoft.com/sharepoint/soap/directory/", 
    Use = SoapBindingUse.Literal, ParameterStyle = SoapParameterStyle.Wrapped)]
public void AddUserToGroup(
    string groupName,
    string userName,
    string userLoginName,
    string userEmail,
    string userNotes
)

Parameters

  • groupName
    Type: System.String

    A string that contains the name of the group.

  • userName
    Type: System.String

    A string that contains the display name of the user.

  • userLoginName
    Type: System.String

    A string that contains the user name (DOMAIN\User_Alias) of the user.

  • userEmail
    Type: System.String

    A string that contains the e-mail address of the user.

  • userNotes
    Type: System.String

    A string that contains notes for the user.

Examples

The following example adds a user to a group.

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

usrgrpService.AddUserToGroup("Group_Name", "User_Display_Name", _
    "DOMAIN\User_Alias", "User_E-mail", "Notes")
Web_Reference_Folder_Name.UserGroup usrgrpService = new Web_Reference_Folder_Name.UserGroup();
usrgrpService.Credentials= System.Net.CredentialCache.DefaultCredentials;

usrgrpService.AddUserToGroup("Group_Name","User_Display_Name",
    "DOMAIN\\User_Alias","User_E-mail","Notes");

See Also

Reference

UserGroup Class

UserGroup Members

UserGroup Web Service