R – Sharepoint Alerts on List Folders

directorylistsharepoint

I would like to programatically add alert to folders inside a sharepoint list. I have found how to set alerts to a list and this works perfect.

Could someone please help me on how to set alerts to a specific folder which is inside a list.

Below is the code i currently have which sets alerts only to the list.

    using (SPSite site = new SPSite("http://site/"))
{
using (SPWeb web = site.OpenWeb())
{
    SPUser user = web.SiteUsers["domain\\user"];
SPAlert newAlert = user.Alerts.Add();
newAlert.AlertType = SPAlertType.List;
newAlert.List = web.Lists["Documents"];
newAlert.EventType = SPEventType.All;
newAlert.AlertFrequency = SPAlertFrequency.Immediate;
//passing true to Update method will send alert confirmation mail
newAlert.Update(true);
}
}

Your help will be much appreciated

THIS QUESTION IS RESOLVED! PLEASE SEE MY POST BELOW WITH THE LINK – SEE – LINK

Best Answer

This question has been answered very nicely by Steve Curran

Click Here to view the solution