How to extract All the users having ADMIN role from all the Projects of ALM.

Posted: January 26, 2014 in Uncategorized

Imports TDAPIOLELib
Imports SACLIENTLib
Imports System.Xml
Imports System.IO

Module Module1
Sub Main()
Dim fso, f
fso = CreateObject(“Scripting.FileSystemObject”)
f = fso.OpenTextFile(“C:\TEMP\Project_Name_Status_Log_​File.txt”, 2, True)
Dim fso1, f1
fso1 = CreateObject(“Scripting.FileSystemObject”)
f1 = fso.OpenTextFile(“C:\TEMP\Admin_User_Information.t​xt”, 2, True)
Dim tdc
Dim custom As Customization
Dim users As CustomizationUsers
Dim eachuser As CustomizationUser
Dim GetAllCustomUsers As List
Dim GetAllGroupList As List
tdc = CreateObject(“TDApiOle80.TDConnection”)
tdc.InitConnectionEx(“http://almdev/qcbin/”)
Dim objSAClient
Dim ProjectListCapture As List = Nothing
objSAClient = CreateObject(“SAClient.SaApi.9”)
‘then login as admin:
objSAClient.login(“http://almdev/qcbin”, “USER_NAME”, “PASSWORD”)
Dim stream As StringReader
Dim reader As XmlTextReader = Nothing
Dim ProjectName As String = Nothing
Dim Temp = Nothing
stream = New StringReader(objSAClient.GetAllProjects)
reader = New XmlTextReader(stream)

While reader.Read()
If (reader.IsStartElement(“PROJECT_NAME”)) Then ProjectName = reader.ReadElementString
If ProjectName = Temp Then
Continue While
Else
tdc.ConnectProjectEx(“DEFAULT”, ProjectName, “USER_NAME”, “PASSWORD”)
f1.WriteLine(“Project Name::::” + ProjectName)
custom = tdc.Customization
users = custom.Users
GetAllCustomUsers = users.Users()
For Each eachuser In GetAllCustomUsers
If eachuser.InGroup(“TDAdmin”) = True Then
Console.WriteLine(eachuser.Name.ToString)
f1.WriteLine(eachuser.Name.ToString)
End If
Next
custom.Commit()
custom = Nothing
users = Nothing
eachuser = Nothing
GetAllCustomUsers = Nothing
GetAllGroupList = Nothing
End If
Console.WriteLine(ProjectName)
f.WriteLine(ProjectName)
Temp = ProjectName
End While
reader.Close()
f.Close()
fso = Nothing
f = Nothing
f1.Close()
fso1 = Nothing
f1 = Nothing
Console.ReadLine()
End Sub
End Module

Advertisements
Comments
  1. chept says:

    Really help full information 🙂

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s