Hi I am a CS student who is taking their summmer vacation.
I am making a program that uses the win32.Taskscheduler library. I am trying to create a task that runs whether the user is logged in or off. I dont know how to do this. I tried doing
Line 303:
newTask.Principal.LogonType = TaskLogonType.InteractiveTokenOrPassword;
but it gives me an error that I don't understand.
Line 302:
TaskDefinition newTask = item.ts.NewTask();
Any help?
The exception error is:
System.NullReferenceException: Object reference not set to an instance of an object.
at ManualZipHelper.CreateTask.createTask(TaskScheduleItem item) in C:\Users\sl9400\documents\visual studio 2010\Projects\ZipHelper\ManualZipHelper\CreateTask.cs:line 310
at ManualZipHelper.CreateTask.button1_Click(Object sender, EventArgs e) in C:\Users\sl9400\documents\visual studio 2010\Projects\ZipHelper\ManualZipHelper\CreateTask.cs:line 160
Line 310:
item.ts.RootFolder.RegisterTaskDefinition(@"zipHelperTask", newTask, TaskCreation.Create, item.ts.UserName.ToString(), item.ts.UserPassword.ToString(),TaskLogonType.ServiceAccount, null);