AddUserToGroup() public method

Adds the user to the specified group
public AddUserToGroup ( System.DirectoryServices.AccountManagement.UserPrincipal adUser, string groupName ) : void
adUser System.DirectoryServices.AccountManagement.UserPrincipal User to add
groupName string Group to which the user should be added
return void
 /// <summary>
 /// Add the ADUser to a group
 /// </summary>
 /// <param name="groupName">The name of the group to which the user should be added</param>
 public void addToGroup(string groupName)
 {
     try
     {
         _connection.AddUserToGroup(_sourceUser, groupName);
     }
     catch (Exception ex)
     {
         string msg = String.Format("Error adding user '{0}' to group '{1}': '{2}'", this.DisplayName, groupName, ex.Message);
         Console.WriteLine(msg);
         throw new ADException(msg, ex);
     }
 }