Thursday, August 16, 2012

Clean Simple Event Handlers

One of the projects I worked on was using SharePoint 2007.One of the subsites contiains many lists and each one requires some calculation and validation whenever you add or update or delete an item.One of the reasons we made that was the fact SharePoint 2007 doesn't support cascading.A developer worked on the project and used a third party tool to add cascading fields for SharePoint lists and he also used a custom solution he downloaded to attach event handlers for each list he choose.

Well I prefer to avoid these things so I made my own event handlers in SPItemEventReciever and deploy it as a feature.

Just for time saving and because almost all the lists in that site require custom code otherwise it is better to follow a different approach so a different handler is called foreach list instead of one handler for all lists.I will talk about using specific handler foreach list in another article later.

After I deployed my custom SPItemEventReciever feature the surprise was whatever my code is correct or has some errors other things happen even that I can debug my code?!!

So I decided to uninstall all the custom solutions and the Third Party tool for cascading.

I remembered that I used U2U tool (windows application) in the past to explore handlers for the SharePoint List and Remove it.

Unfortunatily I found that tool doesn't exist any more on the web and I don't have time to search for the U2U I copied on another machine 2 years ago.

I searched the web and after around one hour I found a similar tool in codeplex:

Using that tool I found there was some custom handlers still attached for the site lists so I removed them.

After that (at last) my custom reciever class handlers handled the site lists events successfully.  

No comments:

Post a Comment