The CreateUser method can be utilized to create a new user within Checkbox. This user is created with default roles and permissions. You can easily create a user with profile properties via the “Profile” object that you submit with the method call. The sample on the right displays how to create a user with a profile.
class Test { static void Main() { var client = new UserManagementServiceClient(); //Build a user profile SimpleNameValueCollection userProfile = null; var profileProperties = new SimpleNameValue[2]; profileProperties[0] = new SimpleNameValue { Name = "firstName", Value = "Test-FirstName" }; profileProperties[1] = new SimpleNameValue { Name = "lastName", Value = "Test-LastName" }; userProfile = new SimpleNameValueCollection { NameValueList = profileProperties }; //End building of user profile var newUser = client.CreateUser(authToken, "Test-Username", "Test-Password", "Test-Email@testemail.com", userProfile, true); if (!newUser.CallSuccess) { Console.WriteLine(newUser.FailureMessage); return; } Console.WriteLine("User created with username {0}", newUser.ResultData); //Always close the client client.Close(); } }
Input Parameters
Parameter | Type | Description |
---|---|---|
authToken | string | Authentication token to validate permission over the data requested |
userName | string | Username to create for the new user |
password | string | Password for the new user |
emailAddress | string | Email address of the new user |
profile | SimpleNameValueCollection | This object takes in key/value ( NameValueList ) object to fill in the users profile |
updateIfExists | bool | If set to true the application will update the user if it exists with the information provided. If set to false the application will ignore the request if the user exists. |