IScheduledWorkItem::DeleteTrigger method

[[This API may be altered or unavailable in subsequent versions of the operating system or product. Please use the Task Scheduler 2.0 Interfaces instead.] ]

Deletes a trigger from a work item.


HRESULT DeleteTrigger(
  WORD iTrigger



A trigger index value that specifies the trigger to be deleted. For more information, see Remarks.

Return Value

The DeleteTrigger method returns one of the following values.

Return code Description
The operation was successful.
The arguments are not valid.
Not enough memory is available.


A trigger index is created for each trigger when the trigger is created. However, it is not a unique identifier for a specific trigger. For example, if you create four triggers, they will be numbered 0 through 3. But if the second trigger is deleted, the remaining triggers will be numbered 0 through 2. Note that the index of the first trigger is always 0, and the index of the last trigger is one less than the total number of triggers for the work item (TriggerCount -1).

You can retrieve the trigger count using IScheduledWorkItem::GetTriggerCount.

To complete the deletion of the trigger, programs must call the IPersistFile::Save method after calling DeleteTrigger. Calling IPersistFile::Save saves the changes to disk.


Minimum supported client Windows 2000 Professional [desktop apps only]
Minimum supported server Windows 2000 Server [desktop apps only]
Target Platform Windows
Header mstask.h
Library Mstask.lib
DLL Mstask.dll
Redistributable Internet Explorer 4.0 or later on Windows NT 4.0 and Windows 95

See Also