none
SharePoint Alerts not working correctly

    질문

  • I develop on SharePoint 2013 foundation. For some SharePoint list there is immediately created alert for special user. Alert created programmatically. User noticed about list items fields changing through email. So may question when list fields changed different times user receive email only for one change, why? For more information Immediately Alert timer job run after that fields changing. How to configure alert programmatically (C#) in order alert to work for two changes or there is another way?
    2018년 5월 17일 목요일 오전 8:17

모든 응답

  • Hi Gurgen,

    Please create the alert like code snippet below:

      static void Main(string[] args)
            {
    
             using (SPSite site = new SPSite("http://sp/sites/dev"))
                    {
                        using (SPWeb objWeb = site.OpenWeb())
                        {
                            objWeb.AllowUnsafeUpdates = true;
                            SPList list = objWeb.Lists["RestDate"];
                            SPUser currentuser = objWeb.CurrentUser;
                            SPAlert newAlert = currentuser.Alerts.Add();
                            newAlert.Title = list.Title;
                            newAlert.AlertType = SPAlertType.List;
                            newAlert.List = list;
                            newAlert.DeliveryChannels = SPAlertDeliveryChannels.Email;
                            newAlert.EventType = SPEventType.Modify;
                            newAlert.AlertFrequency = SPAlertFrequency.Immediate;
                            newAlert.Update();
                            objWeb.Update();
                        }
                    }
               
            }

    And it will send alert for multiple changes, see the email alert like below:

    Changed Title alert:

    Changed a Date Field Alert:

    Thanks

    Best Regards


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnsf@microsoft.com.


    Click here to learn more. Visit the dedicated forum to share, explore and talk to experts about Microsoft Teams.

    2018년 5월 18일 금요일 오전 10:32
  • Hi Jerry,

    My custom alert created by the same code. 
    Did you check changes alerting when "Immediate Alert" timer job run late specially when two changes already done? 
    For me alert run only for one change.

    Thanks

    Best Regards

    2018년 5월 21일 월요일 오전 8:51
  • Hi Gurgen,

    Yes, after I edit the list item, the Immediate Alert will run, this is the Timer Job details in my side:

    And the email alert will send for multiple changes in the list items:

    And note if the changes is based on the same item, then the email alert will only send once which will contain all changes in the specific list item like the capture:

    Thanks

    Best Regards


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnsf@microsoft.com.


    Click here to learn more. Visit the dedicated forum to share, explore and talk to experts about Microsoft Teams.

    2018년 5월 23일 수요일 오전 9:18