I am trying to create Timer Job with feature scope Site collection. If we activate the feature for particular site collection, the timer job should start at that site collection.

Eg: I have created a Timer Job for sending an email to employees who have not completed a task.

I want this timer job to run on only required site collection. If I activate the feature on particular site collection It will run according to schedule on that site collection only and if I deactivate the feature It should stop.

2 Answers 2


A timer job cannot easily be bound to a given site collection. And most importantly, they're not supposed to be; it's not the SharePoint "way of life"!

  1. Jobs are attached to the farm or to Web applications.
  2. Creating the job from a Site collection feature means the code will run under the identity of either the current user (who has no permission to create jobs) or the pool's identity (in case you use RunWithElevatedPrivileges) who has probably no write access to the config DB (if the farm is correctly set-up).

The correct way to achieve what you need is:

  1. Add a second feature to your project/WSP.
  2. This new feature is "Web application" scoped
  3. In the Execute method of the job, you loop trough all collections in the Web app.
  4. For each Collection, you check if the first feature (the site collection one) is activated or not.
  5. If it is, you do what you have to do on it.
  6. Optionally, you can add a feature dependency on the first feature (site coll) to the Web app feature, so it cannot be activated without the job being there first.

You need to create a normal timer job which would be created using an empty sharepoint project and inheriting the


Once this class is inherited, you would need to override the Execute() where you have to put all your logic. Go to the Solution Explorer and Add a new Feature. Here you would need to define @ what intervals do you want the timer job to execute i.e Hourly, Weekly, Monthly etc.In order to set the scope, you need to go to the properties of the feature. There will be a dropdown which shall allow you to select the Scope.

This shall help you.

  • I am able to create a timer job. My requirement is to deply it with feature scope Site colletion. Active feaure at site colletion then code under execurte methode will run for that perticular site collection only. Jul 23, 2015 at 13:16
  • Eg:Consider I have two site colletion which has "Training" List. List has a data related to employee training. I want to create timer job that will send an email to all employee who have not completed training. I have this list at two site collection level Site collection 1 and site collection 2. If I activate feature at site collection 1 , timer job should run for Training List of site collection 1 only and not for training list at site collection 2. If I activate feature at site collection 2 , timer job should also work for Training List in site collection 2. Hope my requirement is clear. Jul 23, 2015 at 13:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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