Click here to Skip to main content
15,902,846 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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:
MIDL
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);
Posted
Updated 5-Jul-11 7:00am
v3
Comments
Dave Kreskowiak 1-Jul-11 17:18pm    
and the error would be ............?? It's kind of an important piece of information.
Member 8015046 1-Jul-11 19:54pm    
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 270
at ManualZipHelper.CreateTask.button1_Click(Object sender, EventArgs e) in C:\Users\sl9400\documents\visual studio 2010\Projects\ZipHelper\ManualZipHelper\CreateTask.cs:line 160 .

1 solution

Have you noticed the TaskSchedulerHelp.zip file on this page[^]?? It contains the documentation on the library and may just hold the answer to your question.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900