How to set project administrator to a user via OTA?


I have an Excel macro in order to assign usergroup (Developer, QATester, etc...) to a user for different projects. It works perfectly, but not for the group "TDAdmin". The macro runs ok (no error is shown), but when I check in project customization  the group TDAdmin has not been added.

The code I'm using is (before this code I have connected to the proper project):

Public Sub AssignUserGroup(tdc As TDConnection, com As TDAPIOLELib.Command, User As String, Group As String)

Dim Cust As Customization
Dim Custusers
Dim CustUsersGroups
Dim CustGroup
Set Cust = tdc.Customization


Set Custusers = Cust.Users

'The user is already created and linked to project, I just assign the UserGroup passed

Set CustUsersGroups = Cust.UsersGroups
Set CustGroup = CustUsersGroups.Group(Group)
CustGroup.AddUser (User)


End Sub

Do you know why it's not working with TDAdmin group? Do you know any other way to that? I have more than 100 projects and I need to assign a new user as Project Administrator.

Many thanks in advance.


  • Verified Answer

    It may depend on the userID your connecting to ALM with, which group they're part of or what permissions they have in their configuration.

    Alternatively you can use the OTA SiteAdmin API, it has an AddUsersToGroup subroutine you can call too, plus it lets you specify domain and project, so it might be a better avenue for applying this to 100 projects.

    - MD

  • Many thanks for your response!

    I have used SA API and it worked!

    Here you are the code if you could need it (sorry for some comments in Spanish ;-)):

    'Comprobamos el número de usuarios a añadir
    'Activar el libro
    Set EA = CreateObject("Excel.Application")
    Set EB = ThisWorkbook
    Set ES = EB.ActiveSheet
    On Error Resume Next

    'Obtener el Usuario de QC de la hoja excel con el que vamos a realizar los cambios
    qcLogin = Trim(ES.Cells(6, 3).Value)
    qcPassword = Trim(ES.Cells(7, 3).Value)

    'Comprobamos el número de usuarios para los que vamos a asignar como Project Administrator

    intNumUsuarios = Trim(ES.Cells(8, 3).Value)

    intNumProyectos = Trim(ES.Cells(9, 3).Value)

    strPerfil = "TDAdmin"

    Dim objSAClient As New SACLIENTLib.SAapi 'Instantiate saclient

    objSAClient = CreateObject("SAClient.SaApi")

    On Error Resume Next
    objSAClient.Login qcServer, qcLogin, qcPassword
    If err.Number <> 0 Then
    MsgBox "Fail to connect to server."
    MsgBox err.Description
    MsgBox "Connected OK to server: " & qcServer

    End If

    For i = 1 To intNumProyectos
    strDominio = Trim(ES.Cells(12 i, 3).Value)
    strProyecto = Trim(ES.Cells(12 i, 4).Value)

    MsgBox "Dominio: " & strDominio & " -> Proyecto: " & strProyecto & " -> Perfil: " & strPerfil

    For j = 1 To intNumUsuarios
    strUsuario = Trim(ES.Cells(12 j, 2).Value)

    'Asignamos el perfil de Administrador al usuario
    objSAClient.AddUsersToGroup strDominio, strProyecto, strPerfil, strUsuario

    If err.Number <> 0 Then
    MsgBox "Fail to AddUserToGroup"
    MsgBox err.Description
    End If


    'Mensaje al finalizar todos los proyecto
    MsgBox "Se ha finalizado añadir el Perfil a " & intNumUsuarios & " usuarios en " & intNumProyectos & " proyectos ", vbInformation, "Añadir usuario"


    MsgBox "Se ha deslogado del SiteAdmin"

    Set objSAClient = Nothing