Skip to main content

Users.CreateUserAsync

Description

Creates a new User of type UserInfo with specified NewUserInfo details inside the connected Control Room.

Signature [C#]

Task<UserInfo> CreateUserAsync(NewUserInfo newUserInfo)

Properties

Input

PropertyDescription
NewUserInfoSpecify the details to create new User.

Output

PropertyDescription
Task<UserInfo>Returns newly created user details.

Remarks

Use CreateTaskAsync API to add new user with specified NewUserInfo from the connected Conrol Room.

Example

C#
public void CreateUser()
{
IControlRoomContext context = LoginControlRoom("RegularBuild", "BasicAuth");

List<Role> roles = new List<Role>();
Role role = new Role();
role.RoleId = 1;
roles.Add(role);

NewUserInfo newUserInfo = new NewUserInfo()
{
UserName = "tester",
FirstName = "ibqa",
LastName = "user",
EmailAddress ="ibqa@vitinfotech.com",
Pwd = "password",
isEnabled = true,
roles = roles
};

UserInfo createUser = Task.Run(() => context.Users.CreateUserAsync(newUserInfo)).Result;
System.Console.WriteLine("Username: " + createUser.UserName);
}
C#
public IControlRoomContext LoginControlRoom()
{
IControlRoomContext context;
string connectionString;

connectionString = "ServerUrl=https://demo.onnitellibuddies.com;UserName=demoadmin;Password=password";
context = new ControlRoomContext(connectionString);

context.Open();
return context;
}