Access to Trigger description

Mar 23, 2011 at 1:58 PM

Is there a way to get the trigger description text as displayed by the Task Scheduler?  E.g., Run "At 1:31 PM every 2 days - After triggered, repeat every 00:10:00 indefinitely."

Mar 23, 2011 at 4:38 PM


Mar 23, 2011 at 5:31 PM

As smvdh noted, the Trigger.ToString() method will do that. Since the library is using a resource file for all that text, you can also support localization by supplying your own translated resources asssemblies. Assuming your task is registered and there is only one trigger, the code would look something like the following:

TaskService ts = new TaskService();
string descText = ts.GetTask("MyTaskName").Definition.Triggers[0].ToString();