6.12. Responding to EventsChapter 5 showed how to create email alerts that notify you when a document changes. Email alerts are sent for several general types of changes. You can also respond to changes by enabling an event handler for the library. Event handlers are code blocks activated by specific occurrences, enabling you to respond to specific changes, such as document approval or rejection , and create a response that is more complex than sending email. Event handlers are written by programmers. As a member, you need to know how they work and how to enable them for your library. Event handlers can respond to these types of events:
When an event occurs in the document library, SharePoint calls the event handler DLL and provides an SPListEvent object that includes the type of event, the document that changed, and the properties of the document before and after the change. The code in the DLL uses that information to decide what to do. For example, your company might use an event handler to send notification to a vendor when an invoice is approved. Figure 6-17 shows how the process would work. animal 6-17. Using an event handler to notify a vendorBefore you can use event handlers, your SharePoint administrator must enable events for the server, and your programming staff must create and install the DLL that handles the event. Usually, they will create one DLL that contains a separate class for each library. To enable an event handler for a library:
Figure 6-18 shows the event handler settings for a document library. This is the same page used to enable email submissions. animal 6-18. Setting advanced options on a libraryThe Properties field shown in Figure 6-18 is for special items the event handler may use. Ask your programming staff if you need to enter anything there. |