Adding Work Items

There are two ways to add work items to the Scheduled Tasksfolder. You can create a new work item within the folder, or you can add an existing work item to the folder.

Note

Currently, only task objects can be added to the Scheduled Tasks folder. When adding a task, you must know the identifiers for the task class and the task interface ITask.

 

You create new work items by calling the ITaskScheduler::NewWorkItem method. This method creates a new work item object using the name that you provide and adds the work item to the Scheduled Tasks folder. When you create a new work item, the Task Scheduler allocates the memory that is required for the new object.

To add existing work items to the Scheduled Tasks folder, call the ITaskScheduler::AddWorkItem method. When you call this method, you must create the object.

The names you supply for work items must be unique within the Scheduled Tasks folder. If a work item with the same name already exists when you call either the ITaskScheduler::NewWorkItem method or the ITaskScheduler::AddWorkItem method, the method returns an ERROR_FILE_EXISTS error. For more information, see Creating a Task Using NewWorkItem Example.