Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I would like to know when and how many SPAlerts are sent to a specific user, is there any way to do this?

share|improve this question
    
You need to clarify as one alert can send many emails - so are you asking how many emails all alerts have been sent to a user or how many alerts a user is signed up to? –  Ryan Jan 12 '11 at 12:54

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.

share|improve this answer

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();
}    
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.