How to retreive QC user's email using QC OTA API and Vbscript (270 Views)
Reply
Occasional Contributor
kasukur
Posts: 2
Registered: ‎06-17-2014
Message 1 of 2 (270 Views)
Accepted Solution

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

 

Valued Contributor
Ramesh35
Posts: 43
Registered: ‎12-17-2013
Message 2 of 2 (256 Views)

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

The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation.