This project has moved. For the latest updates, please go here.

How to create a Task using TaskSchedulerWizard for a specific folder?

Jan 14, 2012 at 8:49 PM

Hi.

How can I get the TaskSchedulerWizard to create a task in a specific folder?

/M

Coordinator
Jan 15, 2012 at 9:21 PM

Use something like the following code:

using (TaskService ts = new TaskService())
{
  TaskSchedulerWizard wiz = new TaskSchedulerWizard();
  wiz.Initialize(ts);
  wiz.RegisterTaskOnFinish = false;
  if (wiz.ShowDialog() == DialogResult.OK)
  {
    TaskFolder folder = ts.GetFolder(@"\MyFolder");
    folder.RegisterTaskDefinition(wiz.TaskName, wiz.TaskDefinition);
  }
}

Jan 17, 2012 at 10:26 AM

Thanks.

That worked great.

/M