Click or drag to resize
Task Scheduler Managed Class Library

TaskFolderImportTask Method

Imports a Task from an XML file.

Namespace:  Microsoft.Win32.TaskScheduler
Assembly:  Microsoft.Win32.TaskScheduler (in Microsoft.Win32.TaskScheduler.dll) Version: 2.10.1
Syntax
public Task ImportTask(
	string path,
	string xmlFile,
	bool overwriteExisting = true
)
Request Example View Source

Parameters

path
Type: SystemString
The task name. If this value is NULL, the task will be registered in the root task folder and the task name will be a GUID value that is created by the Task Scheduler service. A task name cannot begin or end with a space character. The '.' character cannot be used to specify the current task folder and the '..' characters cannot be used to specify the parent task folder in the path.
xmlFile
Type: SystemString
The file containing the XML-formatted definition of the task.
overwriteExisting (Optional)
Type: SystemBoolean
If set to , overwrites any existing task with the same name.

Return Value

Type: Task
A Task instance that represents the new task.
Exceptions
ExceptionCondition
NotV1SupportedExceptionImporting from an XML file is only supported under Task Scheduler 2.0.
See Also