Share via


Alert Object Model

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.

Use the Alerts property of either the SPUser or SPWeb class to return a Microsoft.SharePoint.SPAlertCollection object that represents the collection of alerts for the user or Web site. Use an indexer to return a single alert from the collection.

For example, if the collection is assigned to a variable named collAlerts, use collAlerts[index] in C#, or collAlerts(index) in Microsoft Visual Basic, where index is either the index number of the alert in the collection or the display name of the alert.

Note

Use the Update method after making any changes to the alert.

Alerts Object Model

The following table briefly describes the alert classes, structures, and enumerations. Code examples are located in the appropriate reference topics.

Class, Structure, or Enumeration

Description

SPAlert

Represents an alert. Provides information about the alert, such as which alert template is used, the alert frequency, and the ID of the user who created the alert.

SPAlertCollection

A collection of SPAlert objects. Iterate through alerts for a Web site or user. Use the Add and Delete methods to programmatically add or delete alerts.

SPAlertTemplate

Information about an alert template.

SPAlertTemplateCollection

A collection of alert templates.

SPAlertFrequency

An enumeration that specifies the time interval for sending an alert.

SPAlertEventData

A structure that provides information about an alert event.

SPAlertHandlerParams

A structure that contains a lightweight SPAlert object.

SPAlertStatus

An enumeration that specifies the status of an alert: Error, On, or Off.

SPAlertType

An enumeration that specifies the type of an alert: custom, item, or list.

See Also

Concepts

Alerts in Windows SharePoint Services