Getting the List of TestStand Users Programmatically

Updated May 3, 2018

Reported In

Software

  • TestStand 2016 SP1
  • TestStand 2016
  • TestStand 2014 SP1

Issue Details

I would like to programmatically access the TestStand list of users on a test station, in order to get the number of configured users or the name of each user.  Where can I find this information?

Solution

Using TestStand API, you can programmatically get the list of users and access each user's attributes by calling the following API expressions:
  1. Call RunState.Engine.UsersFile.UserList property, which returns the reference to an array of Users, each belonging to Property Object class. 
  2. Call RunState.Engine.UsersFile.UserList.GetNumElements() method to get the number of configured users.
  3. Call GetPropertyObjectByOffset method to access each User object individually, passing an offset value which corresponds to the index of the array element you need to get. 
  4. For example, to retrieve the name of the first user in the TestStand users list, you can call the following expression: RunState.Engine.UsersFile.UserList.GetPropertyObjectByOffset(0,0).Name

Additional Information

If you would simply like to know who how many users are currently configured as having access to a test station and display a pop-up containing this information, you can refer to Popup List of Users on Test Station Community Example.
You can also place GetPropertyObjectByOffset method  in a loop, incrementing the offset parameter at each iteration of the loop, in order to loop though the entire array of users.

WAS THIS ARTICLE HELPFUL?

Not Helpful