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

Error creating a task

Oct 26, 2010 at 1:38 PM

 

Hello everyone,

I'm running a web app on Windows 2008 server box under .NET 3.5

Creating a scheduled task from the web app like this:
using (TaskService ts = new TaskService("localhost", tsuser, tsdomain, tspass, false))
        {

             ... blablabla ...

             ts.RootFolder.RegisterTaskDefinition(@"Run Report " + id, td);

        }

The app throws back an exception instead of creating a task:

The filename, directory name, or volume label syntax is incorrect. (Exception from HRESULT: 0x8007007B)

Exception Details: System.IO.FileNotFoundException: The filename, directory name, or volume label syntax is incorrect. (Exception from HRESULT: 0x8007007B)

[FileNotFoundException: The filename, directory name, or volume label syntax is incorrect. (Exception from HRESULT: 0x8007007B)]
Microsoft.Win32.TaskScheduler.V2Interop.ITaskFolder.RegisterTaskDefinition(String Path, ITaskDefinition pDefinition, Int32 flags, Object UserId, Object password, TaskLogonType LogonType, Object sddl) +0
Microsoft.Win32.TaskScheduler.TaskFolder.RegisterTaskDefinition(String Path, TaskDefinition definition, TaskCreation createType, String UserId, String password, TaskLogonType LogonType, String sddl) +96
Microsoft.Win32.TaskScheduler.TaskFolder.RegisterTaskDefinition(String Path, TaskDefinition definition) +67

I looked around on forums but haven't seen anyone run into this before. Anyone got suggestions? :)

Oct 26, 2010 at 7:59 PM

Apparently this was due to a special character in Task Name. I apologize for inconvenience. This part works just fine.