Unable to get Repetition Working

Nov 6, 2008 at 6:15 PM
I can create new tasks, but I haven't been able to get repetition working.  Sample code below.  Windows 2003.  After running the code, the task appears in the Scheduled Tasks folder, but in the task's properties, Schedule tab, Advanced Schedule Options, the Repeat Task checkbox is not checked.  Am I missing something or is it broken?

        Dim ts As New TaskService
        Dim td As TaskDefinition = ts.NewTask
        td.RegistrationInfo.Description = "Test"
        Dim wt As New WeeklyTrigger()
        wt.DaysOfWeek = DaysOfTheWeek.Monday Or DaysOfTheWeek.Tuesday Or DaysOfTheWeek.Wednesday Or DaysOfTheWeek.Thursday Or DaysOfTheWeek.Friday Or DaysOfTheWeek.Saturday
        wt.StartBoundary = Now
        wt.Repetition.Duration = TimeSpan.FromMinutes(660)
        wt.Repetition.Interval = TimeSpan.FromMinutes(10)

        Dim t As Trigger = td.Triggers.Add(wt)
        't.Repetition.Duration = TimeSpan.FromMinutes(660)
        't.Repetition.Interval = TimeSpan.FromMinutes(10)

        td.Actions.Add(New ExecAction("notepad.exe", "E:\Temp\Test.log", Nothing))
        ts.RootFolder.RegisterTaskDefinition("Test", td)

Nov 10, 2008 at 8:43 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.