Introduction:
SharePoint 2010 provides the capability to subscribe the content through a feature called "Alerts". Alerts can be subscribed for at one of the four levels list, document library, list item and document. This also enables you to be notified by e-mail of any changes made to the content of your SharePoint Web site. In this article we will be seeing how to create an alert for a particular user and for a specified document library using the SharePoint object model.
For configuring alerts in SharePoint 2010 through out of the box refer to my previous article http://www.c-sharpcorner.com/UploadFile/anavijai/7593/ (Copy and paste the hyperlink).
SPAlert Class:
This class is used to represent an alert, which generates periodic e-mail or Short Message Service (SMS) notifications sent to a user about the list, list item, document, or document library to which the alert applies. Using this class we will be creating a new alert for a document library.
Steps involved:
SPAlertType Enumeration:
It is used to specify the type of item to which an alert applies. Here I am applying the alert to the document library, so I have chosen "List" as my alert type.
SPAlertDeliveryChannels Enumeration:
It is used to specify the method of delivering alerts.
SPAlertFrequency Enumeration:
It is used to specify the time interval for sending an alert about changes to a specific list, list item, document library, or document.
SPEventType Enumeration:
It is used to specify the type of event for a list, list item, document, or document library to which an alert responds.