Quantcast
Viewing all articles
Browse latest Browse all 14708

Re: How to get users and member of (permission level) for a project?

Hi,

 

I did try to run the script in excel VB Editor i got the error Compile error Invalid outside procedure for the first line.

 

I did modify code as below, Let me know am i doing any thing wrong, 

 

server = "http://qcalm......./qcbin/"
domain = "domain_name"
project = "Project_Name"
user = "User"
Password = "password"

Set tdc = CreateObject("TDApiOle80.TDConnection")
tdc.InitConnectionEx "http://qcalm........./qcbin/"
tdc.Login user, Password
tdc.Connect domain, project
Set cust = tdc.Customization
cust.Load
Set custUsers = cust.Users
Set Users = custUsers.Users
Set grps = cust.UsersGroups
Set groups = grps.groups

 

Dim Excel, Sheet
Dim Row
Row = 2


'Open Excel
Set Excel = CreateObject("Excel.Application")


'Add a new workbook
Excel.Workbooks.Add

'Get the first worksheet.
Set Sheet = Excel.ActiveSheet

'sheet name as Users
Sheet.Name = "users"

Sheet.Cells(1, 1) = "User ID"
Sheet.Cells(1, 2) = "Full Name"
Sheet.Cells(1, 3) = "Email Address"
Sheet.Cells(1, 4) = "Group"
Sheet.Cells(1, 5) = "Phone"

 

For Each usr In Users
grouplist = ""
For Each Group In groups
If usr.InGroup(Group.Name) Then
grouplist = grouplist & Group.Name & ";"
End If
Next
Sheet.Cells(Row, 1).Value = usr.Name
Sheet.Cells(Row, 2).Value = usr.FullName
Sheet.Cells(Row, 3).Value = usr.Email
Sheet.Cells(Row, 4).Value = grouplist
Sheet.Cells(Row, 5).Value = usr.phone
Row = Row + 1
'f.WriteLine usr.Name & ";" & usr.FullName & ";" & usr.Email & ";" & grouplist
Next

Excel.ActiveWorkbook.SaveAs ("C:\" & "Users_" & project & "_Users_List.xls")
Excel.Quit
tdc.Disconnect
tdc.ReleaseConnection


MsgBox "Finished listing users Path is :" & "C:\" & "Users_" & project & "_Users_List.xls"


Viewing all articles
Browse latest Browse all 14708

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>