Skip to main content
Version: Current

TaskServices.FetchMyTasksAsync

Description​

The API gets the list of tasks for the current user.

Signature [C#]​

Task<CRTasks> FetchMyTasksAsync(TaskQueryOptions taskQueryOptions);

Properties​

Input​

ParameterTypeRequired / defaultDescription
taskQueryOptionsTaskQueryOptionsRequiredRepresents the options used to query and retrieve task information.

Output​

PropertyDescription
Task<CRTasks>Returns tasks information for current user.

Remarks​

Use FetchMyTasksAsync API to get the list of tasks information for the current user.

Example​

C#
public async Task FetchMyTasks()
{
IControlRoomContext context = LoginControlRoom();
try
{
var filter = new ArrayList
{
new ArrayList
{
"status",
"=",
"Completed"
},
"or",
new ArrayList
{
"status",
"=",
"Assigned"
}
};
var sort = new[]
{
new Sorting
{
Selector = "taskId",
Desc = true
}
};
var taskQueryOptions = new TaskQueryOptions
{
Skip = 0,
Take = 1000,
Filter = filter,
Sort = sort,
RequireTotalCount = true,
IsInOutArgsRequired = true
};
CRTasks cRTasks = await context.Tasks.FetchMyTasksAsync(taskQueryOptions);
foreach (CRTaskInfo taskData in cRTasks.Data)
System.Console.WriteLine("Task Name: " + taskData.Name);
}
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.