0

I'm trying to create a custom Alert Notification handler that implements IAlertNotifyHandler to intercept immediate alerts generated by changed to publishing pages.

I've followed this guide, and also this one. I've also made changes to alerttemplates.xml in the 14 Hive, and run stsadm -o updatealerttemplates. I've also iisreset and made sure alerts are actually being generated by viewing the log file, which says it attempts to send alert emails.

But whatever I do, I can't get my alert notification handler to fire. I've tried both attaching to all the w3wp.exe processes with the Visual Studio 2010 debugger, and also tried writing to both the SharePoint log and the Windows Event log from within the handler. I get nothing.

This is the XML added for my custom alert notification handler:

<NotificationHandlerAssembly>
    MyAssembly, Version=1.0.0.0, Culture=neutral,
    PublicKeyToken=...
</NotificationHandlerAssembly>
<NotificationHandlerClassName>
    MyAssembly.MyClass
</NotificationHandlerClassName>
<NotificationHandlerProperties></NotificationHandlerProperties>         

I've added this to the two built-in alert templates for SPAlertTemplateType.GenericList and SPAlertTemplateType.WebPageLibrary.

The class looks like this:

public class MyAlertNotifyHandler : IAlertNotifyHandler {
    public bool OnNotification(SPAlertHandlerParams ahp) {
        // ...

Does anyone have an idea why this isn't working?

2

The AlertTemplate actually being used when making changes to a Publishing Page in a Pages list in a Publishing Web is the SPAlertTemplateType.DocumentLibrary.

Adding the handler to the properties of this alert template makes the handler run.

Very strange though - I would have thought the Pages list in a Publishing Web would match SPAlertTemplateType.WebPageLibrary.

0

You have to attach to the OWSTimer service for debugging; run the Immediate Alerts job to execute the alerts. I usually restart the timer service before I attach to the process.

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.