Absent Member.. Edward_Allen Absent Member..
Absent Member..
894 views

Regarding the customizationUser object in QC OTA API reference

Hi ,

  I am trying to come up with a code which retrieves the inactive/active users in a project.

 

Here is my code for activating a customizationusers object

 


Set usr = QCConnection.Customization
Set usr1 = usr.Users
Set usr2 = usr1.Users

Debug.Print usr2.Count

 

Using the above code I am able to get the customizationUsers Object,

 

 

I achieved the customizationUsers Object without any declaration like  dim x as customizationusers

 

But i also want a  customizationUser Object

 

I tried the below code for acheiving customizationUser Object,

 

 

Set usr = QCConnection.Customization
Set user1 = usr.Users
Set user2= user1.User

 

 

But it shows the property or number of arguments is wrong.

 

I also tried dim Y as customizationUser

 

But it shows User defined object type not defined .

 

Can someone please help

0 Likes
6 Replies
Established Member.. William Schmitt
Established Member..

Re: Regarding the customizationUser object in QC OTA API reference

You have to load the customization data first.  After your 'Set usr', add a 'usr.Load' statement.

0 Likes
Absent Member.. Edward_Allen Absent Member..
Absent Member..

Re: Regarding the customizationUser object in QC OTA API reference

Hi William ,

   Thanks a ton for your response.

 

i am pretty new to OTA API of QC . Pardon me if my doubts are pretty oridinary..

 

I tried the option usr.load but it fails. I have pasted my code . Can you please help me where it has modified and is there anything more to added to it.

 

 

Public pro As String
Public QCConnection
Public UserName, Password
Public user_cust

 

 

 

Public Sub CommandButton1_Click()

Call connectz

 

 

End Sub

Public Sub CommandButton2_Click()


pro = Me.ComboBox1.Value

 

 


QCConnection.Connect "DEFAULT", pro

If (QCConnection.LoggedIn <> True) Then


Label4.Visible = "true"
Label4.Caption = "Your Connection Failed"

Else

Label4.Visible = "true"

Label4.Caption = "You are now connected to ALM QC " & pro

End If


End Sub

Public Function connectz()

Set QCConnection = CreateObject("TDApiOle80.TDConnection")

UserName = TextBox1.Value


Password = TextBox2.Value

QCConnection.InitConnectionEx "QC_URL"
QCConnection.Login UserName, Password


Set projectList = QCConnection.GetAllVisibleProjectDescriptors

For Each project In projectList
ComboBox1.AddItem (project.Name)


Next

End Function


Private Sub CommandButton3_Click()

Set usr = QCConnection.Customization

If usr.Load = False Then

MsgBox " its not loading "

End If

Set usr1 = usr.Users
Set usr2 = usr1.Users

Debug.Print usr2.Count

MsgBox " The Total Number of Users is " & usr2.Count

i = 0

Dim demo As Variant


demo = "D:\test.csv"


Open demo For Output As #2


For Each user_cust In usr2


Write #2, user_cust.Name

i = i + 1

Next user_cust

Close #2

End Sub


Private Sub CommandButton4_Click()

QCConnection.logout
QCConnection.releaseconnection

Label4.Caption = " You have logged out "

End Sub

 

 

I actually want to get the inactive users in a project . hence I want to get into the customizationuser object and user the inactive property.

 

Right now this code creates a excel called test which contains all the user names in D drive

 

Thanks.

Edward

 

0 Likes
Knowledge Partner
Knowledge Partner

Re: Regarding the customizationUser object in QC OTA API reference

Edward,

 

May be you have to try something like below:

 

Get hold of the Customization -> then get hold of the Users list in the Customization and after that loop through each user based on a group condition.

 

usr.InGroup("Inactive") 

 then write it to the excel column.

 

 

Example:

Set cust = tdc.Customization cust.Load Set custUsers = cust.Users Set users = custUsers.Users For Each usr in users If usr.InGroup("TDAdmin") Then f.WriteLine usr.Name End If Next Set cust = Nothing Set custUsers = Nothing Set users = Nothing

 Regards,

Srihari

0 Likes
Established Member.. William Schmitt
Established Member..

Re: Regarding the customizationUser object in QC OTA API reference

Load is a method, not a property - it doesn't return a true/false.  Your statement should be just  'usr.Load'.

 

You should check in the OTA Reference guide.  It has examples for most things that you want to do.

0 Likes
Established Member.. Avinash01
Established Member..

Re: Regarding the customizationUser object in QC OTA API reference

if you are looking to get inactive users from entire SA uou can use below query?

 

select DISTINCT USER_NAME as UID,EMAIL as Email, Full_Name as Name from QCSITEADMIN_DB.td.users WHERE USER_NAME NOT IN (
select DISTINCT USER_NAME from QCSITEADMIN_DB.td.SESSIONS_HISTORY  WHERE END_TIME > '02/02/2013'
) ORDER BY USER_NAME

 

Thanks,

Avi.

0 Likes
Absent Member.. Edward_Allen Absent Member..
Absent Member..

Re: Regarding the customizationUser object in QC OTA API reference

Thanks everyone for your responses.

 

@Avinash : I am trying to get this macro for users who are not familar with SQL queries. So hence I went for OTA API.

 

right now I am able to get the list of inactive users in a project by using @Srihari_Amgen method of using usr.Ingroup("Inactive").

 

Is there a way to create a list of active users in the project too using ingroup method ?

 

 

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.