I am having problems temporarily disabling email notification when updating items so that the system does not send an unnecessary email. What I'm trying to do is turn off the alert, update the item, and then turn on the alert.
SPList tasklist = Web.Lists ["Tasks"];
tasklist.EnableAssignToEmail = false; // This property makes sending mail disabled.
tasklist.Update ();
// Do the whole update here
Item ["Name"] = "New Name"; Item.update ();
tasklist.EnableAssignToEmail = true; // enable email notification
tasklist.Update ();
As soon as I turned on the warning, the changes made in the middle of the code still trigger the warning and send the email.
Anyone have an idea to solve this problem? Thanks.
source share