Below is the example of using the SetScheduler operation to change task parameters. The request contains moniker of scheduled tasks container and a pattern indicating whether tasks properties must be changed. A task with a new execution period is also sent.
{ "SetScheduler" : { "tScheduler" : { "id" : "S1!M!6445" }, "tArg" : { "pattern" : { "obInst" : "true", "tasks" : "Change", "task" : { "properties" : "true" } }, "meta" : { "tasks" : { "its" : { "it" : [ { "k" : "6449", "id" : "RUN_MODULE", "type" : "Unknown", "properties" : { "period" : { "type" : "Daily", "startDateTime" : "2000-01-01T00:00:00", "stopDateTime" : "2010-01-01T00:00:00" }, "active" : "false" } } ] } } } } } }
{ "SetSchedulerResult" : { "id" : { "id" : "S1!M!6445" } } }
The specified ChangeTastProperty function changes task properties. The container instance moniker and updated task properties are sent as input parameters. The function body contains the pattern indicating whether task must be changed. The result of the function is the result of the operation.
public static SetSchedulerResult ChangeTaskProperty(SchedulerId moniker, SchedulerTask task) { var somClient = new SomPortTypeClient(); // Proxy object for operation exectuion //Operation execution parameters var tSet = new SetScheduler() { tScheduler = moniker, tArg = new SetSchedulerArg()
{ //Pattern that specify whether to change task pattern = new SchedulerMdPattern { tasks = ListOperation.Change, task = new SchedulerTaskPattern() { properties = true } }
meta = new SchedulerMd() { tasks = new SchedulerTasks() { its = new SchedulerTask[] { new SchedulerTask() { id = task.id, k = task.k,
//Updated task properties properties = new SchedulerTaskProperties() { active = false, period = new SchedulerTaskPeriod() { type = SchedulerTaskPeriodType.Daily, startDateTime = DateTime.Parse("01.01.2000"), stopDateTime = DateTime.Parse("01.01.2010") }
} } } } } } }; //Start task scheduler var tResult = somClient.SetScheduler(tSet); return tResult; }
See also: