How to Disable/Enable User Alerts in SharePoint Office 365 using CSOM PowerShell

Sathish Nadarajan
Solution Architect
February 13, 2018
Rate this article
[Total: 0    Average: 0/5]

Any list will be having a “alert me” functionality and the user they themselves can create alerts like, whenever a new document is created/updated an email/sms will be triggered for those users.




During the Migration, if these alerts were enabled, then while doing a bulk upload, the end users will be getting a huge number of mails. Hence, we need to disable the alerts, not deleting the alerts. For that, there is no direct option on the screen, but Powershell does that.

 Import-Module   'C:\SATHISH\PRACTICE SOURCE CODES\Office365.Console\packages\Microsoft.SharePointOnline.CSOM.16.1.6420.1200\lib\net45\Microsoft.SharePoint.Client.dll'
 Import-Module   'C:\SATHISH\PRACTICE SOURCE CODES\Office365.Console\packages\Microsoft.SharePointOnline.CSOM.16.1.6420.1200\lib\net45\Microsoft.SharePoint.Client.Runtime.dll'
 #Mysite URL
 $site = 'https://**********'
 #Admin User Principal Name
 $admin = 'sathish@********.OnMicrosoft.Com'
 #Get Password as secure String
 $password = Read-Host 'Enter Password' -AsSecureString
 #Get the Client Context and Bind the Site Collection
 $context = New-Object Microsoft.SharePoint.Client.ClientContext($site)
 $credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($admin , $password)
 $context.Credentials = $credentials
 foreach($alert in $context.Web.Alerts)
     if($alert.Status -eq 'On')
 #The below will enable the Alert
 # $alert.Status = 'On' 
 #The below will disable the Alert
         $alert.Status = 'Off'
     Write-Host $alert.Title + "-" + $alert.Status
 Write-Host $context.Web.Alerts.Count 

Happy Coding,

Sathish Nadarajan.

Author Info

Sathish Nadarajan
Solution Architect
Rate this article
[Total: 0    Average: 0/5]
Sathish is a Microsoft MVP for SharePoint (Office Servers and Services) having 13+ years of experience in Microsoft Technologies. He holds a Masters Degree in Computer Aided Design and Business more

Leave a comment