The class used to create an alert and generate periodic email, sms to the intended user of the sharepoint site, this alert are related to creation, addition, modification, deletion ect on the list or the document libraries.
We can use following codes to set the “eventtypeindex” property of the SPAlert to specify on what action the alert is generated or created:
- all = 0
- added = 1
- modify = 2
- deleted = 3
- web discussions = 4
which can be specified as follows :
//newAlert.EventType = SPEventType.Add;
newAlert.Properties["eventtypeindex"] = "1";
So following is the complete code for creating an alert