This project has moved. For the latest updates, please go here.

Deletion/Unregister Task

Topics: Examples
Feb 8, 2014 at 11:01 PM
This library has been great for scheduling & modifying tasks in Windows Scheduler, but I've run into a problem that I could not find a method for, it may not exist in your library. How can a previously created and registered task be deleted or unregistered from Windows Scheduler? I wanted to offer an option to clear out their previously created task, but am having trouble figuring out how to do this.

The TaskService only appears to offer AddTask methods, but not RemoveTask. I do see that there is a DeleteTask method in the TaskFolder class, but I'm not 100% sure how to utilize this since I was not using any particular folders when I originally implemented scheduling.
Coordinator
Feb 10, 2014 at 4:19 PM
You found it. Removing a task is done through the TaskFolder.RemoveTask method. If a folder has not been specified when registering a task, then it will be found in the root folder. TaskService has a RootFolder property to expose this. See this link for an example: https://taskscheduler.codeplex.com/wikipage?title=Examples&referringTitle=Documentation#editor.
Marked as answer by JNYRanger on 2/10/2014 at 5:26 PM
Feb 11, 2014 at 1:26 AM
Perfect. Figured this out a bit before you posted, but thanks for confirming!