Skip to main content

Tasks.GetTaskByIdAsync

Description

Gets the task information with the specified task ID from the connected Control Room

Signature [C#]

Task<CRTaskInfo> GetTaskByIdAsync(int taskId)

Properties

Input

PropertyDescription
taskIdSpecify the task ID for which the information must be retrieved.

Output

| Task<CRTaskInfo> | Returns the information of a task using its Id. | |||

Remarks

Use GetTaskByIdAsync API to get the task information with the specified ID from the connected Control Room.

Example

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

int taskId = 1;

CRTaskInfo cRTaskInfo = Task.Run(() => context.Tasks.GetTaskByIdAsync(taskId)).Result;
System.Console.WriteLine("Task Name: " + taskData.Name);
}
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;
}