Skip to main content

Users.GetUserByIdAsync

Description

Gets UserInfo details with the specified User Id from the connected Control Room.

C#

Task<UserInfo> GetUserByIdAsync(int userId)

Properties

Input

PropertyDescription
userIdSpecify the user Id to retrieve the information.

Output

| Task<UserInfo> | Returns the information of a user using Id. | |||

Remarks

Use GetUserByIdAsync API to get the UserInfo details from the connected Control Room.

Example

C#
public void GetUserById()
{
IControlRoomContext context = LoginControlRoom("RegularBuild", "BasicAuth");
int userId = 1;

UserInfo userInfo = Task.Run(() => context.Users.GetUserByIdAsync(userId)).Result;
Console.WriteLine("User Name: " + userInfo.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;
}