Recently I had to write a Custom Timer Job in SharePoint.
The idea was to remove old items from a contacts list.
All the items that were older then 5 days had to be removed from the list.
At first I intended to do this with the information management policy build in SharePoint lists. If you want to know more about how to do this follow this link.
After evaluating this option with my superior we agreed that it would be better if we would do this programmatically.
So I was asked to create a custom timer job programmatically.
I expected this to be a long quest for information but it turned out to be a very short quest to the blog of Andrew Connell.
Andrew already made a post on this matter. It helped me create my timer job.
I also found the code to be easy to understand.
The bottom line is that I'm creating a class that inherrits from the SPJobDefinition class already build in SharePoint. You have to add some constructors and override the Execute method to make it work as intended. Wrap this class in a feature and activate it at Site level. Voila, a working custom timer job.
For more information (and code examples) on how to make a custom timer job I recommend you to read Andrew Connell's post titled Creating Custom SharePoint Timer Jobs
maandag 17 december 2007
Abonneren op:
Posts (Atom)