Friday, November 21, 2008

Custom Alert Template

To customize alerts template:
  1. Create a working copy of AlertTemplates.xml. File Alerttemplates.xml is located at: Local_Drive\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\Template\XML directory.
    Note Do not modify Alerttemplates.xml itself. Make changes to a working copy.
  2. Edit the working copy that you just created.
    Use the stsadm command to read the changed templates into the database. STSADM -o updatealerttemplates -url -filename .
  3. Restart IIS.
    Note It may be necessary to restart SharePoint Timer Services.

To assign a custom alert template to a specific list:

Create a new custom template with a unique Name attribute in your working copy of AlertTemplates.xml (You can copy paste the entire section with Name SPAlertTemplateType.GenericList, change the name and modify the sections you want to). Modify the template as necessary. After restarting IIS, write object model code to set the list alert template.
SPAlertTemplateCollection ats = new SPAlertTemplateCollection((SPWebService)(WebApplication.Parent)); //give appropriate values for WebApplication
list.AlertTemplate = ats["name from above"];

More information about Alerts Customization here

No comments: