Scheduled Task Communication (using ITask interface)?
-
05-07-2019 - |
Question
Is there anyway using the ITask interface to communicate with a scheduled task? I have tasks that users can cancel, pause, etc and a main console that displays information about the tasks. Right now I can only tell if they are running or not via the GetStatus method. What I would like to do is connect to the task and pass a string (potentially xml). Anyone know if this is possible?
Solution
The only strings you can pass to an ITask object are a directory path and command-line parameters. You cannot communicate with the task itself while it is running.
On the other hand, if you use the Task Scheduler 2.0 interfaces instead, then ITaskDefinition has a Data property that you can assign arbitrary text to.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow