How to count the number of alerts using latest release of CSOM

Krishna KV
Team Leader, Aspire Systems
Published On :   02 Mar 2017
Visit Count
Today :  3    Total :   2387
Plan, Migrate, Secure, Report
SharePoint & Office 365 Tool. Simple & Easy to Use. 15-Day Trial!

SharePoint Office 365 Tool
Simple & Powerful Tool for Migration, Security & Reporting. Free Trial

In this article we can have a look into the code snippet to get the count of alerts with the latest version of CSOM that was released during Jan 2017. More information on this release can be found here.


1. Create a new Console application project

2. Add Microsoft.sharepointonline.csom package using nuget package manager.


 public static SecureString PasswordToSecure(string password)
 	if (string.IsNullOrWhiteSpace(password))
 		return null;
 		SecureString secureString = new SecureString();
 		foreach (char c in password.ToCharArray())
 		return secureString;
 static void Main(string[] args)
 	using (var clientContext = new ClientContext(""))
 		var password = PasswordToSecure("xxxx");
 		clientContext.Credentials = new SharePointOnlineCredentials("",password );
 		var currentUser = clientContext.Web.CurrentUser;
 		var alerts = currentUser.Alerts;
 		Console.WriteLine("Total number alerts : " + alerts.Count);
SharePoint Usage Reports
Usage reports, collaboration and audit for SharePoint.

SharePoint Analytics