1

Has anyone successfully implemented IAlertUpdateHandler on SP 2010?

When I try to add a new alert on a document Library following this tutorial, everithing seems to be fine. But when I try to insert a new alert, the code on Debug mode does not trigger.

Furthermore, after inserting a new element into the library, the ribbon appears like to freeze, no any action can be made on it.

enter image description here

My code :

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SP = Microsoft.SharePoint.Client;
using Microsoft.SharePoint.Client;
using System.Net;
using Microsoft.SharePoint;
using System.Web;
using Microsoft.SharePoint.Utilities;
using Microsoft.SharePoint.Administration;

namespace My.CustomAlert
{

     public class Class1 : IAlertNotifyHandler{

        #region IAlertNotifyHandler Members

     public bool OnNotification(SPAlertHandlerParams ahp)
        {

            try{}catch{}

        }
     public bool PostUpdate(SPAlertHandlerParams ahp)
        {  
           try{}catch{}

        }     

    public bool PreUpdate(SPAlertHandlerParams ahp)
        {
           try{}catch{}
        }       

    }
  • To which process did you attach Visual Studio to debug the event handler being thrown? You have to use owstimer! Also if you didn't modify the default document library event handler you need to assign the new handler to the list programmatically. I got some code in my solution, but too long ago, can't figure it out the fast way. – Andreas Feb 5 '16 at 14:43
  • Thank you so much. One more question. where can I find all alerts that have not been sent ? – hello B Feb 5 '16 at 14:55
  • Did attaching the process to owstimer.exe help you? Regarding your 2nd question there is no simple answer to that. From what I remember each change which fits the conditions for an alert handler is processed and alerts are being send out. On the other side, if an alert fails, SharePoint doesn't remember. Fire and forget even if there is an error. – Andreas Feb 5 '16 at 15:01
0

I want to highlight the answer I've given in the comments, since it helped @hello B

If you want to debug Alert Handler using Visual Studio, you have to attach your process to owstimer.exe instead of w3wp.exe. Also after deploying new code you need to restart SharePoint Timer Service for changes to come in effect.

On a side note make sure you're creating a matching custom alert template for the type of list you're using. If not, events are not going to be fired.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.