Grab list of users from AD

Hey guys, I connected gateway with out Active Directory and can see the users their roles and email and phone numbers just fine, Now I want to see if I can grab the list of all the users on there so I can display it in a drop down so users can select a name and depending on the name selected they can send emails to that person. Tried to look around but didn’t find anything to help me. any suggestions?

https://docs.inductiveautomation.com/display/DOC79/system.user.getUsers

1 Like

Thank you, I don’t know how I missed that one… :confounded:

I have a followup question, I'm able to get what I want, now I'm stuck in adding my data to a data set table or a dropdown. I'm using the following code:

users = system.user.getUsers("")
table = event.source.parent.getComponent('Table')
for user in users:
.......name = str(user.get(user.FirstName))+ " " +str(user.get(user.LastName))
.......email = str(user.get(user.Username))+"@gmail.com"
.......headers = ["Name", "Email"]
.......data =
.......data.append([name,email])
.......table.data = system.dataset.toDataSet(headers, data)

This is done on the scripting portion of a button, I'm able to write to the table but it only write one row, shouldn't this loop through every record and insert them to the table dataset?
The dots show indentation.

Every iteration of the loop you start with an empty data list, append one user to it, then set that as the dataset on the table.

You should probably initialize the data list outside the loop.

1 Like

go figure… :disappointed_relieved: :joy:
Thanks!!

And perform the assignment to table.data after the loop.

thankfully I managed not to mess that part up lol…