Do you SharePoint?

Let's talk about it.
posts - 19, comments - 8, trackbacks - 0

Wednesday, October 29, 2008

SharePoint Timer Service and custom jobs

When deploying custom SPOneTimeSchedule job definitions sometimes the timer service (OWSTIMER.EXE) just sorta sits there. Your job definition is created, but isn't executed. It will most likely eventually run, but I have better things to do than sit around wait for it. Setting the time for the job in the past seems to move things along faster.

// Create new job
CustomJob MyJob = new CustomJob(Constants.JOB_NAME, webApp, properties.Definition.DisplayName);
MyJob.Title = Constants.JOB_TITLE;

// Set up the job to run once
MyJob.Schedule = new SPOneTimeSchedule(DateTime.Now.AddHours(-4));
MyJob.Update();

posted @ Wednesday, October 29, 2008 12:17 PM | Feedback (0) | Filed Under [ Development WSS 3.0 MOSS 2007 ]

Powered by: