Customizing alerts format in MOSS 2007  
Author Message
NatalieEW





PostPosted: SharePoint - Design and Customization, Customizing alerts format in MOSS 2007 Top

When I set up alerts, they are sent using a view, I assume. I'd like to change that view so I can control the columns being displayed in the alert. Ideally, I'd be able to modify the format of the alert completely (including the link bar), but I'll settle for at least choosing the columns...

Can someone point me in the right direction

Thanks!




SharePoint Products and Technologies1  
 
 
Chase M





PostPosted: SharePoint - Design and Customization, Customizing alerts format in MOSS 2007 Top

In the object model, each SPList has an AlertTemplate property which you can get/set.

The AlertTemplate is CAML which defines what the Alert will look like. You would need to modify the CAML to include extra colums or data you want in the alert.

Here's an example I used to change the definition of an alert template on the Shared Documents library.

To create my .xml file, I previously set a breakpoint in the code and copied the AlertTemplate property's text view to a file.

using (SPSite site = new SPSite("http://myServer:7337"))
using (SPWeb web = site.OpenWeb(""))
{
SPList list = web.Lists["Shared Documents"];

XmlDocument doc = new XmlDocument();

list.AlertTemplate.Xml = doc.InnerXml;
list.AlertTemplate.Update();
}