Scope of a timer job feature
Asked Answered
B

1

8

I am writing a timer job for the first time. I am following the examples that can be obtained by googling as my reference.

In many such articles, I am coming across the timer job features being activated to the Site Collection level or the Site level.

I feel this is weird, since there can be only one instance of a timer job for a particular web application.

Should't all the timer job features be scoped to a Web application?

Am I missing anything here?

Balmung answered 27/4, 2009 at 10:9 Comment(0)
H
6

It depends entirely on your scenario. The timer jobs I've written so far I have scoped by web application (it's just a matter of modifying your feature.xml). However, depending on what your timer job does, it might make sense from a user perspective to have it web or site scoped. You'd only need to make your feature receiver aware of the 'parent' that's passed in the Activated etc. notification handlers -- it will be the SPWeb, SPSite or SPWebApplication that the feature was activated on -- and you could save yourself writing a configuration interface just to have users set which webs your timer job should work with, and which not. Technically you're correct: they always run on the web application level. But since they often work with content that's web or site related, scoping this way might be a useful way to limit the, well, scope of the timer job.

Hurlow answered 27/4, 2009 at 10:35 Comment(1)
I have an existing timer job scoped at the Farm level... but with a move to SharePoint 2013, I may modify it for the Web Application.Hypoderma

© 2022 - 2024 — McMap. All rights reserved.