Method CreateTask
- Namespace
 - Skyline.DataMiner.Core.DataMinerSystem.Common
 
- Assembly
 - Skyline.DataMiner.Core.DataMinerSystem.Common.dll
 
CreateTask(object[])
Creates the specified task. Replaces: slScheduler.SetInfo(userCookie, TSI_CREATE (1), taskData, out response);.
int CreateTask(object[] createData)
Parameters
createDataobject[]Array of data as expected by old Interop call.
Returns
- int
 The ID of the created task.
Examples
var dms = protocol.GetDms();
var dma = dms.GetAgent(protocol.DataMinerID);
var scheduler = dma.Scheduler;
DateTime startDate = DateTime.Now.AddDays(5);
DateTime endDate = DateTime.Now.AddDays(10);
string activStartDay = startDate.ToString("yyyy-MM-dd");
string activStopDay = endDate.ToString("yyyy-MM-dd");
string startTime = startDate.ToString("HH:mm:ss");
string endTime = endDate.ToString("HH:mm:ss");
string taskType = "once"; // Task type (1=once , 2=weekly, 3=monthly, 4=daily)
string runInterval = "1"; // Run interval (x minutes(daily) / 1,...,31,101,102(monthly) / 1,3,5,7 (1=Monday, 7=Sunday)(weekly))
string scriptName = "scriptName";
string elemLinked = ""; //"PROTOCOL:1:123:456", // example of linking element 123/456 to script dummy 1
string paramLinked = "";
string taskName = "SchedulerCreateTaskTest";
string taskDescription = "Task description";
object[] schedulerTaskData = new object[] {
new object[] {
	new string[] // general info
	{
		taskName, // [0] : name
		activStartDay, // [1] : start date (YYYY-MM-DD) (leave empty to have start time == current time)
		activStopDay, // [2] : end date (YYYY-MM-DD) (can be left empty)
		startTime, // [3] : start run time (HH:MM)
		taskType, // [4] : task type (daily / monthly / weekly / once)
		runInterval, // [5] : run interval (x minutes / 1,...,31,101,102 / 1,3,5,7 (1=Monday, 7=Sunday)) (101-112 -> months)
		"", // [6] : # of repeats before final actions are executed
		taskDescription, // [7] : description
		"TRUE", // [8] : enabled (TRUE/FALSE)
		endTime, // [9] : end run time (HH:MM) (only affects daily tasks)
		"", // [10]: minutes interval for weekly/monthly tasks. Either an end date or a repeat count should be specified
	}
},
new object[] // repeat actions
{
	new string[] {
		"automation", // action type
		scriptName, // name of automation script
		elemLinked, // example of linking element 123/456 to script dummy 1
		paramLinked, // ... other options & further linking of dummies to elements can be added
		// elem2Linked,
		"CHECKSETS:FALSE",
		"DEFER:False", // run sync
	}
},
new object[] {} // final actions
};
Exceptions
- ArgumentNullException
 createDatais null.