The APIs that are used to manage triggers vary depending on the version of the Task Scheduler. However, in both cases these APIs enable you to create new triggers, retrieve and update existing triggers, and delete triggers that are no longer required.
Applications that are developed using Task Scheduler 2.0 can use objects and interfaces to create, retrieve, modify, and delete the triggers for a task.
In the following illustration, a task specifies a collection of triggers using its Triggers property. This collection contains one or more individual trigger APIs with each API specifying a specific trigger type. For example, in the illustration below the trigger collection contains a boot trigger, logon trigger, and a daily trigger.
For more information about the methods and properties of the objects that are used to specify triggers, see:
For more information about the methods and properties of the interfaces that are used to specify triggers, see:
Existing applications that are developed using Task Scheduler 1.0 can use the methods that are available from the Task Scheduler 1.0 interfaces to create, retrieve, modify, and delete the triggers for a work item. However, note that all Task Scheduler 1.0 interfaces, enumerations, and structures are obsolete and should not be used for the development of new applications.
The two interfaces that are used to do this are shown in the following illustration. The IScheduledWorkItem interface is used to manage all the triggers that are associated with a work item (such management includes creating a new trigger for the work item). The ITaskTrigger interface is used to manage a specific trigger.
The IScheduledWorkItem interface provides methods for creating a new trigger for a work item, retrieving the number of triggers that are associated with a work item, retrieving the trigger structures that are associated with the work item, retrieving trigger strings that are associated with the work item, and for deleting triggers.
Once the trigger object is available, you can use the ITaskTrigger interface to retrieve the trigger structure and the string of the trigger and to set the criteria that is used to fire the trigger. This interface is used only when you are working with a task trigger object.
Build date: 11/16/2013