locked
How to prevent email notifications from being send? RRS feed

  • Question

  • Hello, 

    we got several lists and document libraries which share all one SPFieldUrl. So now I want to go ahead and change the value of this field, without sending out several thousands of notifications.

    I've tried several things so far:

    a.) using SPListItem.SystemUpdate(false) when saving the changes to the item

    b.) iterating through SPWeb.Alerts and setting the Status to SPAlertStatus.Off (which should disable all events)

    c.) deleting the configuration for outgoing emails

    Although I don't understand why .. the mail server I've installed seems to receive still all notifications. After option c.) I even did an IISRESET and rebooting the whole system, but the email server still receives notifications. From my point of view at least with the last option it should have worked. Is there some kind of queue somewhere inside the SQL server?

    Tuesday, February 28, 2012 5:25 PM

Answers

  • The key to my problem was to understand the following dependencies:

    If you're working with a Feature Update/Upgrade you can't deactivate and active the alerts right away, since the alerts have to off when the timerjob is executed. Disabling the alerts by powershell, running the upgrade and enabling them by powershell afterwards seems to be working, although it's a lot of manual work. Also depending on your deactivation/activation script you might lose alerts who have been disabled by the user.

    Monday, April 23, 2012 8:42 AM

All replies

  • The one time I needed to do this I just removed all of the alerts and the re-added them.  That said, what you've tried so far seems like it ought to have worked.
    Tuesday, February 28, 2012 5:35 PM
  • Hmmm that makes me wondering even more, although removing all alerts doesn't seem to be an option. We got round about 100 site collections containing 20 lists each. What could I have done wrong?
    Tuesday, February 28, 2012 5:37 PM
  • The SharePoint Web Application class has a AlertsEnabled property. You could try to set this property to false. http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.administration.spwebapplication.alertsenabled.aspx

    T
    his powershell sample can disable the alerts for a web application:

    $webApp = Get-SPWebApplication http://sharepointwebapp/
    $webApp.AlertsEnabled = $false
    $webApp.Update()


    SharePoint Developer | @zeemanj | Blog

    • Proposed as answer by Varun Malhotra Wednesday, February 29, 2012 2:45 AM
    • Unproposed as answer by Andreas Blueher Wednesday, February 29, 2012 12:35 PM
    Tuesday, February 28, 2012 7:40 PM
  • I have been known to sneak in, change the outgoing SMTP to something else, then make a mass update, then switch it back 10-15 mins later.

    @DavidLozzi
    DavidLozzi.com
    About.me

    Tuesday, February 28, 2012 7:44 PM
  • Hello Jeffrey, 

    with your property you can prevent user from creating new alerts, but still existing alerts are going to send out emails as soon as you change an item anyway. What makes me really wondering is the fact, that after setting the status to off that alerts are still active and send out mails.

    I think I have to give davids approach a try, since it seems to be the last valid option. 

    Can anybody tell me, where the smtp settings could be stored, since after removing the inital configuration, the server still sends out email messages.

    Wednesday, February 29, 2012 1:04 PM
  • There are two spots you can check, in Central Administration, go to (I'm assuming SP2010) System Settings > Configure outgoing e-mail settings. This is the setting for the farm. In addition to that, if you want to modify just one web application, go to Application Management > Manage web applications > Select your app > Select General Settings menu > Outgoing E-Mail.

    @DavidLozzi
    DavidLozzi.com
    About.me

    Wednesday, February 29, 2012 1:26 PM
  • Thanks for the fast reply: "Application Management > Manage web applications > Select your app > Select General Settings menu > Outgoing E-Mail" is based on the same property like the one Jeffrey suggested. 

    I've changed the settings for outgoing email, I've done a mass update and looked into the Timer Job Status. The "Immediate Alerts" job remains at 80% completion. Even after 20 minutes the job seems to be stuck. As soon as I change the settings back to normal all the emails are send. It seems I can't cancel the running timer job.

    Wednesday, February 29, 2012 2:08 PM
  • After re-running the whole procedure and deactivating the timer job it seems to have worked. The timer job seemed to have stopped after round about 25 minutes and when I disabled the timer job the queue seemed to be cleared.

    Although this scenario seems to be everything but ideal, it looks like a possible option. My last concern is the amount of time to execute the timer job on our live system since I've tested with like 5% of the notifications and the live system might take much longer.

    Wednesday, February 29, 2012 2:32 PM
  • The key to my problem was to understand the following dependencies:

    If you're working with a Feature Update/Upgrade you can't deactivate and active the alerts right away, since the alerts have to off when the timerjob is executed. Disabling the alerts by powershell, running the upgrade and enabling them by powershell afterwards seems to be working, although it's a lot of manual work. Also depending on your deactivation/activation script you might lose alerts who have been disabled by the user.

    Monday, April 23, 2012 8:42 AM