1
votes

I've been trying to create a custom alert for SharePoint 2010 using the following guidelines : http://support.microsoft.com/kb/948321/en-us

At this point I haven't succeeded in getting the alert to work. I was wondering of this guide also applies for SharePoint 2010. Because at the button of the article is clearly states:

APPLIES TO

  • Microsoft Office SharePoint Server 2007
  • Microsoft Office SharePoint Server 2007 for Search (Enterprise Edition)
  • Microsoft Office SharePoint Server 2007 for Search (Standard Edition)

Can anyone enlighten me?

Kind regards Oxillery

1

1 Answers

3
votes

I have it working in 2010.

A new Alert Template.

a.Original is found here:

    \14\TEMPLATE\XML\alerttemplates.xml

b.The custom templates are found in this file which has the original definitions plus the custom definitions.

CCPersonalAlertTemplates.xml

c.Load them with stsadm

    stsadm.exe -o updatealerttemplates -url "http://Beefy.com/Sites/my_name" -filename " \CCPersonalAlertTemplates.xml"

d.Every out of the box solution has a matching custom template.

  • The custom templates have a .ext at the end of their name.

  • The custom features also call a custom NotificationHandlerAssembly like this:

     <Properties>
     <NotificationHandlerAssembly>Shared.CCPersonalEmail, Version=1.0.0.0, Culture=neutral, PublicKeyToken=5694e116d3fc8c0c</NotificationHandlerAssembly>
     <NotificationHandlerClassName>Shared.CCPersonalEmail.CCPersonalClass
     </NotificationHandlerClassName> 
     <NotificationHandlerProperties />
     </Properties>
    

Custom Notification Handler assembly

a.IAlertNotifyHandler that implements an OnNotification method - Attempts to send the custom alert (if it fails send normal alert.)

  • Custom alert:

    • Gets the PersonalEmail field data from the User Information List

    • If Personal Email is empty it just sends normal alert

    • If personal email is populated

      • Send normal email to internal email

      • Send reduced email to external address

      • Replace http:// with external address http://extranet-

      • Regex replace (keep content data from being sent)

        <td class=\"formlabel\">.*<td class=\"altvb\">&nbsp;</td>

Make all the alerts use the external template

  • Existing alerts:

    • Site.allwebs.alerts get flipped to the same template name they had with .ext appended

    • Future alerts:

      • Site.allwebs.lists flipped the attached alerttemplates to their .ext counterpart
    • Future webs and their Future lists

      • SPListEventReceiver ListAdded() event flips the template on all lists created in the site collection

Housekeeping

a.During feature activation

  • create a PersonalEmail field on the rootweb’s User Information List (This becomes content so it is not removed upon deactivation)

  • flip all lists and alerts to the custom alert templates.

    • During feature deactivation

      • Flip all lists and alerts back to their respective out of box alert templates