Sign up ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I have a timer job that needs to be executed every 3 hours. Unfortunately, SharePoint's scheduling classes do not facilitate this. How can I achieve this?

Suggestion 1: Thought of running the timer job every hour and maintaining a counter value, hence when the counter reaches 3, I will execute my logic and then reset the counter back to 0. To follow this appraoch I can store the counter value in 2 ways (There maybe more):

  1. Store in the web.config for retrieval and update (AppSettings)

  2. Maintain a SharePoint list to manage the counter value

which way is better to maintain the counter? or is there an easier approach to executing every 3 hours?

share|improve this question
Can you not set SPMinuteSchedule to run every 180 minutes? – Robert Lindgren Jul 14 at 11:57
Tried that and got the 'Message: Specified argument was out of the range of valid values. Parameter name: value' error. – Muhammedh Jul 14 at 12:05
Could very well be an (undocumented) limit on 59 or something then – Robert Lindgren Jul 14 at 12:08
Yep. That's my guess as well. Unfortunately SPHourlySchedule does not have an Interval property. – Muhammedh Jul 14 at 12:09
Yep, this supports that:…. You could possible store a value in the farm propertybag and do your logic on the count of three – Robert Lindgren Jul 14 at 12:10

2 Answers 2

up vote 1 down vote accepted

Do you care what hours it runs at as long as it is a 3 hour interval?

You could have your job scheduled to run every hour. When it runs, get the current hour and use a modulo operation ( to see if it is a multiple of 3.

For e.g.

1 mod 3 = 1, don't run.

2 mod 3 = 2, don't run.

3 mod 3 = 0, run.

4 mod 3 = 1, don't run.

5 mod 3 = 2, don't run.

6 mod 3 = 0, run.


I believe this should work for both 12 and 24 hour clocks.

share|improve this answer
Thanks Steven. This did the trick for me :)! – Muhammedh Jul 15 at 7:26

create a custom list or file to LOG just one entry for your timerjob. schedule your timer job to run based on SPMinuteSchedule once in an hour. so basically it will run every hour but before you run actual task, LOG in your list or file that it is starting up for the 1st time. you can log date and time as well. next time when it will run, check the log entry if the last date time plus datediff is >=2 hour as compared to current time so then run the actual task and at end of actual task, update the list item entry to put new time in. this way atleast your actual task will be run every 2 hour but timer job will run every hour.

This is just a workaroud. This will cause load on server but no choice.

share|improve this answer

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.