You must be logged in to reply to this topic.
Hello All,
I am trying to create something that will read values from a csv or txt file and then use these values as input parameters for Job Creation. I am using VB Express 2008.
I am running into difficulties in the following areas:
1. I want to pass command line parameters for the scheduled .exe file to be run and I do not see how to do this in the API documentation. The program exection area of the online documentation is down.
2. I would like to notify via email if the job fails. I cannot get the GetRecipients method to work.
3. I would like the job to only run on certain days, but the dayintervalcriterion documentation link is broken.
Any help? I have my code that works without these 3 needs to post if necessary.
The command line parameters are set in the CommandLineParameters property of the ProgramExecutionTask.
In what way is the GetRecipient method not working?
DayIntervalCriterion will let you run the job every x days. If you want to select specific days (e.g., Monday and Thursday), you need to use a SpecifyDaysCriterion and add DaySpecifications to it.
When I run my code I get the following error:
Line 110 in my code is:
recipient = GetRecipient("Test User", theScheduler)
If I do not comment out theresponse.Actions.Add(thenotificationaction) it fails here
I have attached the code I am using.
Where is your code for GetRecipient? That's where the failure is occurring (line 221 in module1.vb). Are you using the sample code from the API doc, or something else?
The line you have commented out is adding thenotificationaction before you have created that object. I think you mean for that line to be adding restartAction. You have another line further down where you add thenotificationaction after you have created it and set its properties.
I have modified what I have and it works until the return statements in the GetRecipients method.
I do not understand why the return fails.
New code:
I tried your code and it worked fine. Note that you are adding the response to the step, not the job, so make sure you are looking at the step's responses rather than the job's when you look in the Console.
On a separate note, I noticed that your code is creating a new application object and session on each iteration for your job creation loop. It would be more efficient to move those outside the loop and use the same session for each job that you create.