This project has moved and is read-only. For the latest updates, please go here.

Error when task name is a number

Topics: Errors
Nov 5, 2015 at 1:45 PM
I'm running into an issue when the task name is a number only. When passing this through as taskservice.rootfolder.tasks("TaskName") I get an error that "Value does not fall within the expected range." as it is seeing the name as a number instead of a string. I am passing it as a string so I'm not sure if anyone else has seen this issue.

Any help would be appreciated.

Nov 6, 2015 at 5:10 PM
I'm assuming this is not on a system prior to Windows Vista. If so, then we are dealing with a limitation of the base library from Microsoft. That error comes from calling the base library's IRegisteredTaskCollection.Item property that takes either an integer or a string. If working with the V1 native library on XP systems and earlier, this would be an artifact of the ITaskScheduler.Activate method. I don't put any code between those calls.
Nov 8, 2015 at 4:38 PM
I'm on a win7 machine. I worked pasted it by using the getTasks method using a regular expression. Thanks for the help
Marked as answer by dahall on 11/9/2015 at 11:05 AM