Tasks.DeleteTaskAsync
Description
Deletes an existing Task with a specified Task ID from the connected AI Command Center
Signature [C#]
Task DeleteTaskAsync(int taskId);
Properties
Input
| Parameter | Type | Required / default | Description |
|---|---|---|---|
taskId | int | Required | Specify the taskId to delete. |
Remarks
Use DeleteTaskAsync API to delete a Task with a specified task ID from the connected AI Command Center.
Example
C#
public async Task DeleteTask()
{
IControlRoomContext context = LoginControlRoom();
try
{
int taskId = 1;
await context.Tasks.DeleteTaskAsync(taskId);
}
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.