Roles.GetRoleByIdAsync
Description
Gets a role as Role with specified Role ID from the connected Control Room.
Signature [C#]
Task<Role> GetRoleByIdAsync(int roleId)
Properties
Input
Property | Description |
---|---|
roleId | Specify the Role ID for which the Role information has to be retrieved. |
Output
| Task<Role> | Returns the information of a role using its Id. | |||
Remarks
Use GetRoleByIdAsync API to get the Role with specified role Id from the connected Control Room.
Example
C#
public void GetRoleById()
{
IControlRoomContext context = LoginControlRoom();
int roleId = 5;
Role role = Task.Run(() => context.Roles.GetRoleByIdAsync(expectedRoleId)).Result;
Console.WriteLine("RoleName is " + role.RoleName);
}
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;
}