Tasks: IMetabaseObjectDescriptors;
The Tasks property returns the list of tasks descriptions that were created in the container.
Executing the example requires that the repository contains a scheduled tasks container with the TASK_CONTAINTER identifier.
Sub Main;
Var
MB: IMetabase;
Cont: IScheduledTasksContainer;
Tasks: IMetabaseObjectDescriptors;
MDesc: IMetabaseObjectDescriptor;
Task: IScheduledTask;
Begin
MB := MetabaseClass.Active;
Cont := MB.ItemById("TASK_CONTAINTER").Bind As IScheduledTasksContainer;
Tasks := Cont.Tasks;
For Each MDesc In Tasks Do
Debug.Write("Task: " + MDesc.Name + " State: ");
Task := MDesc.Bind As IScheduledTask;
Select Case (Task.State As Integer)
Case 0: Debug.WriteLine("Not active");
Case 1: Debug.WriteLine("Ready");
Case 2: Debug.WriteLine("In process");
Case 3: Debug.WriteLine("Finished");
Case 4: Debug.WriteLine("Error");
End Select;
End For;
End Sub Main;
After executing the example tasks list and state of each task are displayed in the development environment console.
See also: