Create Task in Specific Folder

Topics: Examples
Feb 28, 2013 at 3:18 PM
Suppose that I have a folder under the root folder called "MyFolder", how can I create task in this folder specifically ?
Feb 28, 2013 at 5:19 PM
// Fill out a TaskDefinition as per examples and documentation
TaskDefinition taskDef = ts.NewTask();
// Add things to TaskDefinition like settings, triggers and actions

// Get a reference to the subfolder
TaskFolder myFolder = ts.RootFolder.SubFolders["MyFolder"];
// Register the task in the subfolder
myFolder.RegisterTaskDefinition("MyTask", taskDef);
Mar 3, 2013 at 7:03 AM
Thanks, I did it also in another way , but I think your way is more proficient.