Export (0) Print
Expand All

Implementing Alert Handlers

Windows SharePoint Services 3

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 catch notification events by implementing the OnNotificationfunction in the IAlertNotifyHandler interface.

You can catch alert creation and modification events by implementing PreUpdate and PostUpdate functions in IAlertUpdateHandler.

You can use the following procedure to implement an alert handler.

To implement an alert handler

  1. Create classes to implement the IAlertNotifyHandler and IAlertUpdateHandler interfaces

  2. Register the assemblies in the global assembly cache.

  3. 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.

NoteNote

When implementing IAlertNotifyHandler, do not access SPAlertCollection or modify the SPAlert object, and always test whether an SPAlert property is null before accessing it.

Show:
© 2014 Microsoft