I have entered a script below, that with the use of Excel, will create a single user in ALM Site Admin, add the user to the active project, as well as the user group specified within the script. I recommend that you try it in your test environment before using it in your production environment. You will need to open Excel, click Alt + F11 to access the VBAProject. Right-click on 'Sheet1' and select 'View Code'. On the blank page that displays, enter the script that I have entered below. You will need to make sure you have the correct Excel Addin installed on your client machine, ALM Connectivity addin installed, and Client Registered. You will also need to edit the script to meet your needs.
Sub AddSiteUser()
'Add a site user
Dim tdc
Dim cust
Dim custuser
Set tdc = CreateObject(''TDApiOle80.TDConnection'')
tdc.InitConnectionEx (''http://your_alm_server:8080/qcbin'')
tdc.Login ''alm_username'', ''alm_password''
tdc.Connect ''ALM_Domain'', ''ALM_Project''
'Check the ALM connection
If tdc.LoggedIn = ''True'' Then
MsgBox (''Connection Successful!'')
Else
MsgBox (''Connection Unsuccessful'')
Exit Sub
End If
Set cust = tdc.Customization
Set custuser = cust.Users
'Check if the new user already exists
If custuser.UserExistsInSite(''andy_test'') Then
MsgBox ''This user already exists in ALM! Goodbye!''
Exit Sub
End If
'Create site user
custuser.AddSiteUser ''andy_test'', _
''Andy Anderson'', ''aanderson@alm_mail.com'', _
''This is for testing only!!!'', _
''555.555.5555'', ''QATester''
'Add an existing site user to the connected project
Dim CustUsersGroups
Dim CustGroup
'Get customization data into the local cache
'Customization Object
tdc.Customization.Load
'Add user to the project with the CustomizationUsers Object
'referenced through TDConnection.Customization.Users
tdc.Customization.Users.AddUser ''andy_test''
'Add the new user to a user group.
Set CustUsersGroups = tdc.Customization.UsersGroups
'AddToUserGroup is a group name, for example ''QATester''
Set CustGroup = CustUsersGroups.Group(''QATester'')
'Add the user.
CustGroup.AddUser ''andy_test''
'Commit the changes to the project.
tdc.Customization.Commit
MsgBox ''The user has been created!''
tdc.Disconnect
tdc.LogOut
tdc.ReleaseConnection
Set tdc = Nothing
MsgBox ''The session has been disconnected.''
End Sub