07/31/2012

Vault API: Users and Roles, part 1

I would like to get a list of the users registered at the Vault server. Could you provide a code sample for this task, please?

Solution

Autodesk.Connectivity.WebServices.AdminService is the class which manipulates users, groups, roles etc.

To access the list of the users, we will need to connect to the Vault server and read the WebServiceManager.AdminService property first. I will create a utility class to maintain the connection (see the MyVaultServiceManager class in the code below).

Next, there is the AdminService.GetAllUsers() method that returns an array of objects of the User class. From the User class we can get information about the user like his/her name, ID, email address etc.

Here is a sample. The AdminSample.PrintUserInfo() method is what you need to call from your program, for example, when the user presses a button:

Comments

I would like to get a list of the users registered at the Vault server. Could you provide a code sample for this task, please?

Solution

Autodesk.Connectivity.WebServices.AdminService is the class which manipulates users, groups, roles etc.

To access the list of the users, we will need to connect to the Vault server and read the WebServiceManager.AdminService property first. I will create a utility class to maintain the connection (see the MyVaultServiceManager class in the code below).

Next, there is the AdminService.GetAllUsers() method that returns an array of objects of the User class. From the User class we can get information about the user like his/her name, ID, email address etc.

Here is a sample. The AdminSample.PrintUserInfo() method is what you need to call from your program, for example, when the user presses a button: