Archive

Posts Tagged ‘timerjob’

SharePoint – Timer Job Executing Multiple Times

March 13, 2014 1 comment

Custom timer jobs are created by inheriting SPJobDefinition class. This class is available under Microsoft.SharePoint.Administration namespace.

Recently I was working on a timer job which was scheduled to run every 5 minutes. After deployment I found the job is invoked multiple times during each 5 minute cycle. In my case this was executing 10 times. This happened because I have 10 content database. To avoid this we should make use of the SPJobLockType enumeration.

public MyCustomTimerJob(string jobName, SPWebApplication webapp) : 
base(jobName, webapp, null, SPJobLockType.Job) {
	this.Title = "My Custom Timer Job";
}

Hope this helps!