Method CreateTaskBuilder
- Namespace
- Skyline.DataMiner.Core.DataMinerSystem.Common
- Assembly
- Skyline.DataMiner.Core.DataMinerSystem.Common.dll
CreateTaskBuilder()
Creates a new task builder for building a task from scratch.
IDmsSchedulerTaskBuilder CreateTaskBuilder()
Returns
- IDmsSchedulerTaskBuilder
A new task builder instance.
Examples
var builder = scheduler.CreateTaskBuilder();
var action = DmsSchedulerActionBuilders.CreateScriptAction()
.WithScriptName("MyScript")
.Build();
// The Build method creates a local object; it is NOT yet created on the DataMiner Agent.
var task = builder
.WithTaskName("New Task")
.WithStartTime(DateTime.Now.AddDays(1))
.AddAction(action)
.Build();
// Call CreateTask to actually create it on the Agent.
int taskId = scheduler.CreateTask(task);
CreateTaskBuilder(IDmsSchedulerTask)
Creates a task builder initialized with values from an existing task.
IDmsSchedulerTaskBuilder CreateTaskBuilder(IDmsSchedulerTask existingTask)
Parameters
existingTaskIDmsSchedulerTaskThe existing task to copy from.
Returns
- IDmsSchedulerTaskBuilder
A task builder instance initialized with the existing task's values.
Examples
var existingTask = scheduler.GetTasks().First();
var builder = scheduler.CreateTaskBuilder(existingTask);
// The Build method creates a local object with modifications; the Agent is NOT updated yet.
var updatedTask = builder
.WithDescription("Modified description")
.WithIsEnabled(false)
.Build();
// Call UpdateTask to apply the changes to the Agent.
scheduler.UpdateTask(updatedTask);
Exceptions
- ArgumentNullException
existingTaskis null.