Move user accounts to a different group

To move user accounts from one group to another, remove the user accounts from the current group and assign the user accounts to the new group. You can assign user accounts to multiple groups using the removeUsersFromGroup() method in the corews web service. To move one user account to a different group, you can use the removeUserFromGroup() method instead.
Before you begin: Retrieve the following variables:
  • userIDs integer array for the IDs of the user accounts you want to move
  • currentGroupID integer for the ID of the group that the user accounts is currently assigned to
  • newGroupID integer for the ID of the group that you want to move the user account to
  1. Invoke removeUsersFromGroup().
    RemoveUsersFromGroupResult removeResult = coreWebService.removeUsersFromGroup(currentGroupID, userIDs);
  2. Check the result for errors and handle any errors.
    if (removeResult.getRemoveUsersFromGroupReturnStatus().getCode()!= RemoveUserFromGroupReturnStatusEnumType.SUCCESS) 
    {
       // handle any errors
    }
  3. Invoke addUsersToGroup() to assign the user accounts to the new group.
    AddUsersToGroupResult addResult = coreWebService.addUsersToGroup(newGroupID, userIDs);
  4. Check the result for errors and handle any errors.
    if (addResult.getAddUsersFromGroupReturnStatus().getCode()!= AddUserToGroupReturnStatusEnumType.SUCCESS) {
       // handle any errors
    }

Was this information helpful? Send us your comments.