Monday, June 19, 2006

MOSS (Sharepoint 2007) event handlers - register only by code

With the sps2003 event sinks, you had to link them to a document library using the "advanced settings" screen in the UI.

This meant that people with permissions to change the list could disconnect the event handler, or even worse -see the settings in the xml data property. This meant that we couldnt use sensitive settings there - for example - a password for a database.

In the new version, linking a list\site to an event handler is done by code. You actually have to write an application that will link it. I am sure microsoft will provide us with a generic application (or if not, its easy enough to create one...I would start on one if I knew that MS isnt going to do it...)

Anyway, this means that we can use the event handlers for preventing list changes - for example we dont want to allow the list administrator to delete an important field that is required by our application, so we write an event handler for the fielddeleting event and cancel the deletion if the field is the sensitive one. Since the list administrators cannot disable the event handler, they will not be able to delete the field.

I wonder (and need to research) how many event handlers can be attached to the same list\site? hmmm....

This new advance is great, and I cant wait to see how we use it in projects. Any ideas for some event handlers that will be needed by everyone?

No comments: