Disable Alerts from a SharePoint List or Library

The end-user came up with a requirement: Disable alerts from a particular SharePoint list, where 100’s of people subscribed already.

Its apparent that we can disable alerts for web application either from Central Administration or executing the stsadm:
stsadm -o setproperty -url http://server_name -pn alerts-enabled -pv false

But here the requirement is to disable alert for a particular library ONLY for some time, and enable it back once the user done with his editing.

I remember SPAlert class has a Status property. why don’t to try setting it OFF? Sounds good! Lets jump to coding, make a console application and give it to the SharePoint Administrator to disable alerts on a SharePoint 2010/2007 list.

Disable alerts for SharePoint list Programmatically:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.SharePoint;
using Microsoft.SharePoint.Administration;
using System.IO;

namespace TurnAlertsOnOff
    class Program
        static void Main(string[] args)
            string site;
            string web;
            string list;
            string option;
            SPSite tmpSite=null;

                //Get the site collection , Sub-site, Lists
                if (args.Length != 3)
                    //Site collection
                    Console.WriteLine("Enter the Site collection URL (E.g.)'http://intranet.company.com' : \n ----------------------------------- \n");
                    site = Console.ReadLine();

                    Console.WriteLine("\n Enter the Sub-Site URL (E.g.) '/Sales/us' (  '/' for root web): \n -------------------------------------- ");
                    web = Console.ReadLine();

                    Console.WriteLine("\n Enter the List Name(Title): (E.g) 'Announcements' : \n -------------------------------------- ");
                    list = Console.ReadLine();

                    //Option ON or OFF
                    Console.WriteLine("\n Enter the Option ON or OFF: \n ----------------------------------- \n ");
                    option = Console.ReadLine();

                    site = args[0];
                    web = args[1];
                    list = args[2];
                    option = args[3];

                tmpSite = new SPSite(site);
                SPWeb tmpWeb = tmpSite.OpenWeb(web);
                SPList tmpList = tmpWeb.Lists[list];

                long alertCounter = 0;
                foreach (SPAlert tmpAlert in tmpWeb.Alerts)
                    option = option.ToUpper();

                    if (option == "ON") //Turn it ON
                        if ((tmpAlert.List.Title == tmpList.Title) & (tmpAlert.Status == SPAlertStatus.Off))
                            tmpAlert.Status = SPAlertStatus.On;
                            Console.WriteLine("Turning ON Alert: {0} in List: {1}", tmpAlert.Title, tmpList.Title);
                    else if (option == "OFF") //Turn it ON
                        if ((tmpAlert.List.Title == tmpList.Title) & (tmpAlert.Status == SPAlertStatus.On))
                            tmpAlert.Status = SPAlertStatus.Off;
                            Console.WriteLine("Turning OFF Alert: {0} in List :{1}", tmpAlert.Title, tmpList.Title);


                //Just to pause
                Console.WriteLine("Done, Processed {0} Alerts! Press a key to Exit.", alertCounter);


            catch (Exception ex)
                Console.WriteLine("Error: " + ex.Message);
                System.Diagnostics.EventLog.WriteEntry("Disable/Enable Alerts", ex.Message);

                //Dispose of the Root Site Object

Compile and execute the code from server will temporarily remove alert from SharePoint list. You can disable alerts in SharePoint list using PowerShell as well. Refer my old posts: Create – Edit – Find – Delete SharePoint Alerts using PowerShell

You can set the immediate alerts job interval to 1 minute by running:  
stsadm -o setproperty -pn job-immediate-alerts -url https://Intranet.company.com -pv “every 1 minutes”

Related post: Disable alerts in SharePoint using PowerShell

Salaudeen Rajack

Salaudeen Rajack is a SharePoint Architect with Two decades of SharePoint Experience. He loves sharing his knowledge and experiences with the SharePoint community, through his real-world articles!

8 thoughts on “Disable Alerts from a SharePoint List or Library

  • May 3, 2017 at 6:11 AM

    Where would I apply this? I’m managing a SharePoint 2013 site I inherited. Have a need for a ListCalendar to temporarily disable Alerts during an update process. I’m not a developer, so don’t know a lot of the back end. Thanks in advance.

    • May 16, 2017 at 4:02 PM

      You need to create a console application with the above code and run it from your SharePoint server. Or you can use the PowerShell code!

  • January 24, 2017 at 8:36 PM

    would this work for SP 2010?

  • August 30, 2012 at 9:02 AM

    Make sure you are updating the Alert Objects after setting its properties!

  • August 9, 2012 at 8:16 PM

    Hi Salaudeen,
    i need to programmatically turn off and on alerts for a list and do batch operation on list data, i followed your blog post and created a alertfunction and implemented like this


    but still iam getting email alerts,any help will be appreciated

    • October 20, 2015 at 8:30 AM

      This code disables ONLY existing alerts in a specific list or library! It doesn’t (of course, can’t!) disable any new alerts you are creating after executing this code on the particular list! You may have to temporarily turn-off alerts on web application level by changing the flag “AlertsEnabled” to “false” as in How to Disable Alerts in SharePoint


Leave a Reply