I would like to know when and how many SPAlerts are sent to a specific user, is there any way to do this?
Asked
Active
Viewed 227 times
2 Answers
2
Easiest way is probably just inspect your mail server logs.
The alerts are just fired out by timerjobs, not sure if it logs how many & to whom they were sent.
James Love
- 25,512
- 2
- 45
- 77
1
here is the code to achieve it:
SPSite oSiteCollection = SPContext.Current.Site;
SPWebCollection collWebsites = oSite.AllWebs;
foreach (SPWeb oWebsite in collWebsites)
{
SPAlertCollection collAlerts = oWebsite.users["LoginName"].Alerts;
foreach (SPAlert oAlert in collAlerts)
{
//do something
}
oWebsite.Dispose();
}
Falak Mahmood
- 17,298
- 2
- 40
- 67