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


Jul 27, 2011 at 5:31 PM

Greetings, I have created code to retrieve a certain scheduled task and I am trying to return the DaysOfWeek that are set.

I know how to get the Trigger type of the targeted scheduled task - and determine whether it is weekly or daily...



But hitting a wall retrieving the DaysOfWeek once I determine the Trigger is weekly.

Any help would be greatly appreciated.



Jul 27, 2011 at 8:29 PM
WeeklyTrigger wt = t.Definition.Triggers[0] as WeeklyTrigger;
if (wt != null)
   return wt.DaysOfWeek;

Each trigger is actually specialized into a class that exposes the unique properties of that kind of trigger. Trigger is an abstract class from which all the trigger specializations are derived. WeeklyTrigger and DailyTrigger are two such specializations. By casting the abstract trigger to the appropriate specialization you can access the properties.