Among the server-side files, there is an XML file called Alerttemplates.xml that is used default to define the format, contents, and properties when a user creates alert messages from each SharePoint list type. SharePoint provides server administrators with the ability to customize this alert template, then deploy it using the stsadm -o updatealerttemplates command.
NOTE: Changes discussed in the following article will affect lists of type Discussion Board and Discussion Board Plus.
In this article, I will demonstrate how you can change the font color from blue to red, and add links to Flat View, Thread View, or Append View for a Discussion Board Plus list in Alert mail.
Traditional alerts produced SharePoint provide the following information:
To modify the contents of the AlertTemplates.xml file, complete these steps:
- Create a working copy of AlertTemplates.xml.
Note: It is strongly recommended that you make a copy of Alerttemplates.xml, and make the changes in the new file, as any update from Microsoft could overwrite your changes in the original file.
Note also: Discussion Board Plus does not modify this file directly so, as a result, your changes will not be affected future Discussion Board Plus product upgrades.
On one of your Web Front-end servers, go to ‘%Program Files%Common FilesMicrosoft SharedWeb Server Extensions14TEMPLATEXML’ and locate the Alerttemplates.xml file:
Copy this file and rename it, giving it a new name. For this article, we will call it NewTemplates.xml:
- Edit the working copy that you just created.
Note: You can use any XML editing tool to edit the templates. I use Notepad to open it.
- We now need to locate the appropriate section of the file to modify. Each list type (Calendar, Tasks, Contacts, etc.) has its own section within the file that defines the layout and content of the alert. To modify Discussion Board Plus alerts, we want to locate the following tag:
In this example, I want to modify and add links to the bar on the top of the alert. To do so, we will locate the following section of code:
And replace it with the following:
The content of the alert is defined between the tags:
For additional details about modifying the contents of the alerts file, refer to the MSDN Article AlertTemplates Schema.
- After modifying the new AlertTemplate file, we will use the stsadm command to write the changed templates into the database.
Note: These tasks require the currently logged-in account have DBAdmin rights to the SharePoint Configuration database.
Open a command window and enter:
Next run the command:
Finally, schedule the timer job to execute the request:
- Restart IIS.
Note: It may also be necessary to restart SharePoint Timer Services.
- Create a Thread or Post in a Discussion Board Plus list, and go to your mail to check Alerts. You will see new changes.
Now, you will see the flexible views for Thread such as Flat View, Thread View, Append View in red as pictured below:
- Customizing Alert Templates in SharePoint Foundation 2010 [SharePointDevWiki]
- How To: Customizing alert emails using IAlertNotifyHandler [MSDN]