Saturday, June 6, 2009

Sharepoint 2007 and WSS 3.0 Timer Jobs Implementation

Timer jobs are a great way to perform additional tasks in the backend of a sharepoint solution.
I currently had to utilise this whilst developing a solution for a human resource company, they wanted the ability for sharepoint to notify there consultants once a candidate contract was about to expire or they could mark the candidate to be contacted in say 6 months time.
I arranged that the solution would deliver an email each day to notify various consultants when this was the case.
I could have performed this operation via a scheduled task but when I discovered timer jobs in Sharepoint I decided to utilise this in order to achieve this functionality.
I admit that timer jobs do take some time initially to configure and get working but once you understand how to deploy and activate this feature it becomes a piece of cake.

I have attached some source code which you can download and then edit/modify via Visual Studio.

Once you have downloaded this solution to deploy this into Sharepoint please refer to the following guide which utilises the tool STSADM which is like a swiss army knife. The utility offers a diverse range of functionality for maintaining and developing your Sharepoint solution.

Deployment Guide:

stsadm -o deactivatefeature -filename XXX\Feature.xml -url http://localhost -force
stsadm -o execadmsvcjobs
stsadm -o retractsolution -name XXX.wsp -immediate
stsadm -o execadmsvcjobs
stsadm -o deletesolution -name XXX.wsp
stsadm -o execadmsvcjobs


stsadm -o addsolution -filename \XXX.wsp
stsadm -o execadmsvcjobs
stsadm -o deploysolution -name XXX.wsp -immediate -allowgacdeployment -force
stsadm -o execadmsvcjobs
stsadm -o activatefeature -filename XXX\Feature.xml -url http://localhost
stsadm -o execadmsvcjobs
net stop sptimerv3
net start sptimerv3
iisreset

There you go that is how you can deploy a timer job solution into a sharepoint solution.
Please email me if you have any further questions regarding this Sharepoint tutorial.
mailto:steve@clickitsolutions

No comments: