Quality Center / ALM Practitioners Forum
Showing results for 
Search instead for 
Do you mean 

How to retreive QC user's email using QC OTA API and Vbscript

SOLVED
Go to Solution
Highlighted
Occasional Contributor

How to retreive QC user's email using QC OTA API and Vbscript

Hi 

 

I am trying to retreive QC user's email from QC using OTA API and VbScript but unsuccessful. OTA API help has some code in VBA but I am unsure how to re-code in VBS. Please help

 

VBA code from the help to retrieve 5 user's names and email address.


Sub ListUsers()

Dim custUsers As CustomizationUsers
Dim usr As CustomizationUser
Dim UList As List

Set custUsers = tdc.Customization.Users

Set UList = custUsers.Users
Debug.Print UList.Count

Dim maxU%, uCnt%

maxU = 5

For Each usr In UList
uCnt = uCnt + 1
With usr
Debug.Print .name & ", " & .Email
End With
If uCnt > maxU Then Exit For
Next usr

Exit Sub
ErrorHandler:
ErrHandler err
End Sub

 

1 REPLY
Trusted Contributor

Re: How to retreive QC user's email using QC OTA API and Vbscript

Hi kasukur ,

 

I am able to get the user's mail id with the below code, I have removed "With" function.

I am not sure why the (With function ) is not working.

 

Set QCConnection = CreateObject("TDApiOle80.TDConnection")


QCConnection.InitConnectionEx "almserver" '<-- Change me.
QCConnection.Login "username", "password"
QCConnection.Connect "Domain", "ProjectName"

Dim custUsers
Dim usr
Dim UList

Set custUsers = QCConnection.Customization.Users

Set UList = custUsers.Users
Debug.Print UList.Count

Dim maxU%, uCnt%

maxU = 5

For Each usr In UList
uCnt = uCnt + 1
MsgBox usr.Name
MsgBox usr.Email
If uCnt > maxU Then Exit For
Next usr

Exit Sub

End Sub