I am here trying to get the Alert count for a user in a site collection(including all the sub sites). The below code only returns Alert count of a root level site. I want all Alerts for a particular user.
SPUserCollection users = web.AllUsers;
foreach (SPUser user in users)
foreach (SPAlert alert in user.Alerts)
If my site collection has 5 sub sites
1) ROOT URL : http://xyz:1001
User ABC has 2 Alerts defined at this level
2) Sub site URL : http://xyz:1001/Sub1
User ABC has 1 Alert defined here
The above code only returning 2. I want total Alert count, that is 3.
Please help me. I appreciate it.
View Complete Post