How to create a custom e-mail alert alert handler in Microsoft Office SharePoint Server
| Article ID | : | 948321 |
| Last Review | : | March 26, 2008 |
| Revision | : | 1.1 |
SUMMARY
You may want to create custom e-mail alert handler in Microsoft Office SharePoint Server 2007 in any of the following scenarios:
| • | Fields, such as the ItemName field, are truncated to 70 characters in the e-mail alert. To work around the 70-character limit, use the method that this article describes. |
| • | You want to embed additional content in the e-mail alert. |
| • | You want to change the layout or the appearance of the e-mail alert. |
MORE INFORMATION
These steps include sample code that formats the output to closely resemble the default alert template e-mail messages. You can modify the HTML in this sample code to customize the resulting e-mail alert.
| 1. | Create a class project that inherits from the IAlertNotificationHandler interface. Include the Microsoft.SharePoint namespace and the Microsoft.SharePoint.Utilities namespace in the project.
Use the following code: |
||||
| 2. | Add a strongly-signed .dll file to the Global Assembly Cache (GAC). You can drag the assembly to the assembly folder. Or, you can use the GACUtil tool to register the .dll file.
For more information, visit the following MSDN Web sites:
For more information, click the following article number to view the article in the Microsoft Knowledge Base: 315682 (/Feedback.aspx?kbNumber=315682/) How to install an assembly in the Global Assembly Cache in Visual Basic .NET or in Visual Basic 2005
|
||||
| 3. | Make a copy of the alertTemplates.xml file that is in the following folder:
C: Program Files Common Files Microsoft Shared Web Server Extensions 12 Template Xml
Name this new file CustomAlertTemplates.xml, and then save the file. Note Do not directly modify the alertTemplates.xml file. Directly modifying this file is unsupported. |
||||
| 4. | Edit the file and search for the keyword properties.Add the following lines to the properties block:
The stub should resemble this now:
Include this XML stub in each alert template section that you want in the alert template file. |
||||
| 5. | At a command prompt, change to the C: Program Files Common Files Microsoft Shared web server extensions 12 BIN directory. Then, run the following command:
stsadm -o updatealerttemplates -filename C: Program Files Common Files Microsoft Shared Web Server Extensions 12 TEMPLATE XML customalerttemplates.xml -url your_sharepoint_site url
|
||||
| 6. | Run the following command:
stsadm -o setproperty -pn job-immediate-alerts -pv every 1 minutes
This command specifies how frequently SharePoint Server checks for alerts that are to be sent immediately. The value specified is in minutes. For this test, the frequency is set to 1 minute. For more information, visit the following Microsoft Web site: http://technet2.microsoft.com/windowsserver/WSS/en/library/0eb072fe-8321-483b-9d1e-3412e3f42a481033.mspx?mfr=true (http://technet2.microsoft.com/windowsserver/WSS/en/library/0eb072fe-8321-483b-9d1e-3412e3f42a481033.mspx?mfr=true)
|
||||
| 7. | Make sure that you have SharePoint configured for outgoing e-mail messages.For more information about how to configure outgoing e-mail messages, visit the following Microsoft Web site:
http://technet2.microsoft.com/windowsserver/WSS/en/library/91570494-09ba-4537-904b-c61a6268d6bc1033.mspx?mfr=true (http://technet2.microsoft.com/windowsserver/WSS/en/library/91570494-09ba-4537-904b-c61a6268d6bc1033.mspx?mfr=true)
|
||||
| 8. | If you are using the document library for the test, make sure that you have alerts for the document library turned on. | ||||
| 9. | Run the following commands:
|
||||
| 10. | In the Services MMC snap-in, restart the Windows SharePoint Services Timer service. |
After you complete these steps, the custom e-mail alert handler should be configured. After you create a new alert, you should receive the updated custom e-mail alert.
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) |
Keywords:Â |
kbhowto kbexpertiseadvanced kbinfo KB948321 |
Microsoft Knowledge Base Article
This article contents is Microsoft Copyrighted material.
Microsoft Corporation. All rights reserved. Terms of Use | Trademarks
You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.
Back to the top
Leave a Reply