Creating Daily Triggers with multiple start time using Taskservice 2.0

Oct 2, 2012 at 6:13 PM

Hi,

how can we create a daily trigger with multiple start time with taskservice.

Coordinator
Oct 2, 2012 at 11:48 PM

Use two daily triggers within the same task.

Oct 4, 2012 at 8:06 PM

In taskscheduler service (microsoft.win32.taskscheduler.dll) does not have a daily trigger constructor that accepts starttime, by default the start time gets sets to

current time.I tried creating two daily triggers with two diff time interval , but only one gets created.

Coordinator
Oct 4, 2012 at 9:41 PM

StartBoundary is a property on all triggers and can be set upon trigger creation. For example, if you wanted to create task that executes every day from this point forward at 2:00 a.m. and 2:00 p.m., you could do the following:

td.Triggers.Add(new DailyTrigger() { StartBoundary = DateTime.Today.AddHours(2) });
td.Triggers.Add(new DailyTrigger() { StartBoundary = DateTime.Today.AddHours(14) });