5.2. Event Handling

WSS v2 offered developers the ability to catch certain user actions in code and react programmatically. These user actions triggered a set of asynchronous events that happened after the user had completed the action. An example is the act of adding a document to a document library. A developer could catch the DocumentAdded event and perform some action. Unfortunately for v2 developers, all of the event handlers were "after-the-fact" handlers. You can't stop a user from performing an action with an event handler. Another limitation of v2 event handlers is that you can only catch events on document and forms libraries.

Fortunately for you, all of this has changed. Now, WSS v3 has a vastly increased number of events developers can take advantage of. These events include "before-the-fact" or synchronous events as well as "after-the-fact" or asynchronous events as illustrated in Figure 5-8. As a developer interested in catching SharePoint events, you are no longer limited to only document libraries and forms libraries. Now you have the ability to catch events on practically every list type that SharePoint offers, as well as at the site level, list, or library level, and at the individual file level. Combine the increase in available functionality of event handlers with Workflow and you'll really have a flexible system.

Figure 5.8. Figure 5-8

5.2.1. Receiving SharePoint ...

Get Professional SharePoint® 2007 Development now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.