SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a situation where I need to move some huge data using a timer job. But I can't do this using OneTimeSchedule as it may impact the performance of my sharepoint application during the peak hours.

I want to make it run for maximum of 5 hours a day starting at 20:00 everyday.

What is the best way?

share|improve this question
up vote 1 down vote accepted

@sebastienlevert - That will just mean that the job starts sometime between 8pm and 1am

You cannot tell the timer service to terminate execution of a given timer job at a certain time they just run until they have finished.

Timer jobs are designed to be small functions (that is why there are so many of them), it is not intended to be a tool for running long processes.

Could your code be moved to another SharePoint server and run through windows scheduled tasks? Alternatively you could set the timer service to restart at a specific time thus killing off all timer jobs (not advised!)

share|improve this answer
If @Faisal codes a SharePoint Job, that would check itself for its total duration? Looping through the process while it has not spent its 5 hours? Would that be a solution that could be use? – Sébastien Levert Oct 7 '10 at 21:03

I think the following snippet of code should do the trick :

SPDailySchedule JobSchedule = new SPDailySchedule();
JobSchedule.BeginHour = 20;
JobSchedule.BeginMinute = 00;
JobSchedule.EndMinute = 00;
JobSchedule.EndHour = 1;

What do you think ?

share|improve this answer
This won't work see my answer. – Charles Lee Oct 7 '10 at 16:08

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.