I'm creating a trigger for a task in Windows using Microsoft.Win32.TaskScheduler.DailyTrigger to run daily at 8am. That task repeats every hour but I want it to stop after 10 hours until it fires up again the next day.
In the Windows task scheduler application, under trigger you have something like "Repeat task every 1 hour for a duration of 10 hours".
The repeat task every hour I can do, but I can't find a way to do the "for a duration of". This is the code I have to set up the trigger so far, startTime is a DateTime set to 8am today.
var dailyTrigger = new DailyTrigger();
dailyTrigger.Repetition.Interval = TimeSpan.FromHours(1);
dailyTrigger.StartBoundary = startTime;
dailyTrigger.ExecutionTimeLimit = TimeSpan.FromMinutes(59);
I could do it with multiple triggers, but I was thinking if the application interface allows it there probably is a way to do it in code.
EDIT: I noticed below is a different class, and the OP probably downloaded a library from Codeplex. The below still applies, it's just
Repetition.Interval
andRepetition.Duration
.https://msdn.microsoft.com/en-us/library/office/microsoft.office.excel.server.addins.computecluster.taskscheduler.trigger.intervalminutes(v=office.12).aspx
https://msdn.microsoft.com/en-us/library/office/microsoft.office.excel.server.addins.computecluster.taskscheduler.trigger.durationminutes(v=office.12).aspx