<Disclaimer>This is personal notes of what I retained during the session. This can be incomplete, partially right or wrong. It is just part of the notes I took and what retained my attention. Nothing prevents the user to get more information on their favorite web site.</Disclaimer>
In this interactive session, Stef Shoffren tried to explain us how to develop, deploy and debug a SharePoint timer job.
SharePoint allows three different scenarios for timer jobs : batch data loading, scheduled tasks and one-off job executed accross the farm such as an IIS restart or a configuration change.
What should not be using this kind of job, typically, it sending e-mails to users, which should be handled by the SharePoint notification service, unless a company policy disallow this.
First, a timer job is implemented by inheriting from the SPJobDefinition class and overriding the Execute method. It is running using the system accounts which makes it the possibility to execute tasks on all the server farms. The problem is that IT Professionnals don’t see Timer jobs with a good eye and see them as a threat because of the priviledges given to the system account.
To store the configuration, there are basically three ways :
1.- A property bag populated when defining the timer job
2.- Settings in the OWSTimer.exe.config
3.- External store such as a SQL database or a SharePoint list, which is the preferred way.
On the logging side, we can distinguish three ways :
1.- Using ULS, the out-of-the-box SharePoint Logging system. According to the audience, it is a real pain to put in setup
2.- Windows EventLog
3.- Enterprise Library Logging
In any of these choice, the logging must be part of the design of the timer job.
To test and debug a timer job, it is necessary to attach the OWSTimer process, which requires the admin rights
In order to deploy a timer job, we can see three means :
1.- Using a feature and a feature receiver
2.- Using an msi Windows Installer
3.- Using a custom executable that must be run from the central administration server.
Note for myself : look for WSPBuilder and WSSDW on codeplex to load data into SharePoint
0 Comments