This project has moved and is read-only. For the latest updates, please go here.

Add new trigger to a existing task

Feb 11, 2012 at 2:46 PM

I wanted to add an timetrigger to an already existing task. How can I do that? I looked at all the examples, but I can't find it there.

Feb 13, 2012 at 5:19 PM
using (TaskService ts = new TaskService())
   // Retrieve the task, change the trigger and re-register it
   Task t = ts.GetTask(taskName);
   td = t.Definition;
   td.Triggers.Add(new TimeTrigger() { StartBoundary = DateTime.Now + TimeSpan.FromHours(1) });
   ts.RootFolder.RegisterTaskDefinition(taskName, td);