Skip to main content
Version: Current

TaskServices.CancelTasksAsync

Description​

Cancel an existing Tasks with a specified Task IDs from the connected AI Command Center.

Signature [C#]​

Task CancelTasksAsync(int[] taskIds);

Properties​

Input​

ParameterTypeRequired / defaultDescription
taskIdsint[]RequiredSpecify the taskIds to cancel.

Remarks​

Use CancelTasksAsync API to cancel a Tasks with a specified task IDs from the connected AI Command Center.

Example​

C#
public async Task CancelTasks()
{
IControlRoomContext context = LoginControlRoom();
try
{
int[] taskIds =
{
1,
2
};
await context.Tasks.CancelTasksAsync(taskIds);
}
finally
{
context.Close();
}
}
Connection helper
public IControlRoomContext LoginControlRoom()
{
string RequiredSetting(string name) => Environment.GetEnvironmentVariable(name) ?? throw new InvalidOperationException($"Set {name} before running this example.");
string serverUrl = RequiredSetting("INTELLIBUDDIES_SERVER_URL");
string userName = RequiredSetting("INTELLIBUDDIES_USERNAME");
string password = RequiredSetting("INTELLIBUDDIES_PASSWORD");
string connectionString = $"ServerUrl={serverUrl};UserName={userName};Password={password}";
IControlRoomContext context = new ControlRoomContext(connectionString);
context.Open();
return context;
}

See Get started for namespaces, configuration, and context cleanup, and SDK usage for error handling.