Implementing Alert Handlers
This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This page may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.
You can use the following procedure to implement an alert handler.
To implement an alert handler
Register the assemblies in the global assembly cache.
Connect the alert template to the handler by using the following format:
<Properties> <NotificationHandlerAssembly> Handler assembly strong name </NotificationHandlerAssembly> <NotificationHandlerClassName> Fully qualified class name </NotificationHandlerClassName> <NotificationHandlerProperties> Other option properties you want to pass </NotificationHandlerProperties> <UpdateHandlerAssembly> Assembly </UpdateHandlerAssembly> <UpdateHandlerClassName> Class name </UpdateHandlerClassName> <UpdateHandlerProperties> Other properties </UpdateHandlerProperties> </Properties>
To catch the event when an alert is triggered, implement IAlertNotifyHandler. OnNotification is called when the alert is triggered. Then use SPUtility.SendEmail or a similar send-mail utility to send the message. A SPAlertHandlerParams object is passed to the function.
To catch the event when a new alert is created or updated (so that you can change its properties or set new properties), implement the IAlertNotifyHandler interface. PreUpdate is called before the changes to the alert are committed to the database; PostUpdate is called after the changes are committed.