Partager via


Add(Microsoft.SharePoint.SPList, Microsoft.SharePoint.SPEventType, Microsoft.SharePoint.SPAlertFrequency) Method

The Add method of the SPAlertCollection class adds an alert to the collection of alerts for a list based on the specified event type and time interval.

Parameters

list   A Microsoft.SharePoint.SPList object that represents the list to which the alert applies.

lEventType   A Microsoft.SharePoint.SPEventType value that specifies the event type for the alert.

lAlertFreq   A Microsoft.SharePoint.SPAlertFrequency value that specifies the frequency for sending an alert.

Return Value

The GUID for the new alert.

Remarks

Use of the Add method sends a confirmation notice to each user telling them that they have successfully added an alert.

Example

The following code example creates a daily alert for every user of a SharePoint site whenever the Announcements list is modified.

This example requires using directives (Imports in Visual Basic) for both the Microsoft.SharePoint and Microsoft.SharePoint.WebControls namespaces.

Requirements

Platforms: Microsoft Windows Server 2003

Security: Code Access Security