Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Scope of a timer job feature

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?

like image 296
ashwnacharya Avatar asked Apr 27 '09 10:04

ashwnacharya


People also ask

What is timer job in SharePoint online?

Remote timer jobs do not run on your SharePoint server. Instead, remote timer jobs are scheduled tasks that run on another server. Examples of how timer jobs are used include: Performing governance tasks, such as displaying a message on the site when certain criteria are not met, or enforcing retention policies.

How do you debug a timer job?

Ones you deploy the timer job go to Services. msc and restart SharePoint Timer Service. Now Search for OWSTIMER process and attach the same in your Solution; Symbols should get load now. I this didnt help probably you need to retract the Solution.DO IISRESET and deploy again then follow the above mentioned procedure.

How do I run a timer in SharePoint 2013?

Solution: Use the Start-SPTimerJob cmdlet. To start a timer job, execute the Start-SPTimerJob cmdlet with the Identity of the timer job or a timer job variable. Listing 4.26 shows a sample command line. In this scenario, the timer job kicks off when you start it manually.


1 Answers

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.

like image 68
ROXORITY SharePoint Web Parts Avatar answered Sep 19 '22 21:09

ROXORITY SharePoint Web Parts