Building Block: Alerts
Published: May 2010
Alerts provide a framework for automating event-driven e-mail or Short Message Service (SMS) notifications that are raised in response to specific events or that run on a schedule. Alerts can be attached to items as granular as list or list item. Microsoft SharePoint Foundation provides a library of alert templates that you can use to enable alerts for common scenarios.
The classes you can use to extend the basic alerts system are located in the Microsoft.SharePoint namespace. The most important classes and interfaces include the following:
SPAlert - Represents an alert and provides information, such as whether it is an e-mail or SMS alert, what alert template is used, the alert frequency, and the ID of the user who created the alert.
SPAlertTemplate – Provides information about an alert template that defines the content and format of an alert. The template also defines styles and rendering for e-mail alerts.
SPAlertEventData – Provides information about an alert event.
IAlertNotifyHandler - Provides a method for handling alert-sending events.
IAlertUpdateHandler - Provides methods for handling changes that are made to an alert’s definition.
For more information about the object model for the alerts framework, see Alert Object Model.
The mobile messaging object model on which the system of SMS message alerts is built is in the Microsoft.SharePoint.MobileMessage namespace. The most critical classes for extending the SMS alerts system are the following:
SPMobileSmsMessage – Represents an SMS message.
SPMobileMessageSmsBuilder – Creates an SMS message.
SPMobileMessageWebService – Provides object-oriented proxies for the Web Methods of the mobile messaging Web service (that uses the Office Mobile Service (OMS) protocol).
For more information about the mobile messaging object model, see Overview of Mobile Messaging Development.
A set of alerts templates is provided, each of which specifies how an e-mail or SMS version of an alert message is structured. These templates are defined in the files AlertTemplates.xml and AlertTemplates_SMS.xml, which are located in the %ProgramFiles%\Common Files\Microsoft Shared\web server extensions\14\Template\XML folder. You cannot change these files, but you can override any template with a template of your own. A simple STSADM command overwrites the default template with your substitute version and that version is stored in the configuration database. For more information, see Predefined Alert Templates, Modifying the Appearance of Alerts, and AlertTemplates Schema.