Updatealerttemplates: Stsadm operation (Office SharePoint Server)

Updated: 2008-11-12

Operation name: Updatealerttemplates

Lets an administrator update custom changes to the Alerttemplates.xml file.

Syntax

stsadm -o updatealerttemplates

   -url <URL name>

   [-filename <file name>]

   [-lcid <language>

Parameters

ParameterValueRequired?Description

url

A valid URL, such as http://server_name

Yes

Specifies the URL name to a site collection.

filename (f)

The name of the alert template file

No

Specifies the Alerttemplates.xml file.

lcid

A valid locale ID, such as "1033" for English

No

Specifies the language locale ID for the alert template.

Remarks

To help users keep track of changes made to a site, Windows SharePoint Services 3.0 includes the alerts feature, which is an e-mail notification service. When documents, lists, or items in a list on a server running Windows SharePoint Services 3.0 are created, modified, or deleted, users can configure which alerts they want to receive, informing them that changes have been made.

Windows SharePoint Services 3.0 includes a set of predefined alert templates. These alert templates are stored in Alerttemplates.xml. Alerttemplates.xml defines the format, contents, and properties used to create alert messages from each list type. Developers can customize alerts by modifying a copy of Alerttemplates.xml and then loading the customized alert templates by using the command stsadm -o updatealerttemplates. For more information, see Predefined Alert Templates (http://go.microsoft.com/fwlink/?LinkID=133225&clcid=0x409).

Do not manually modify or create customizations in the Alerttemplates.xml file. Doing so may result in loss of functionality when upgrading or installing service packs.

Examples

To update the Alerttemplates.xml file for the specified locale , type the following syntax:

stsadm -o updatealerttemplates -url http://localhost -f C:\Alerttemplates.xml –lcid 1033

NoteNote:

Any alert templates in the database that are not in the XML file will not be modified.

NoteNote:

If you want the changes to the template list to take effect immediately, run the iisreset command after you run the updatealerttemplates operation.

Tags :


Community Content

shaham69
Running this command changes the alerttemplate for all the web apps

This command changes the alert template to the one you specify for all web applications on the server. The URL specified doesn't make any difference.

If you want to avoid this, you will have to put a filter in your IAlertNotifyHandler that filters based on the URLs that are part of the alert handler params-

namespace alerthandler
{
class customalerts:IAlertNotifyHandler
{
#region IAlertNotifyHandler Members
public bool OnNotification(SPAlertHandlerParams ahp)
{
SPSite site = null;
SPWeb web = null;
SPList list = null;
SPListItem item = null;
string subject = ahp.headers["Subject"];
string listTitle = string.Empty;


if (ahp.webUrl == "/test")
{...

The above would limit it to the web /test. Note that the ahp.siteUrl is not the site collection, but the root site collection. If you want a reference to the SPSite object where the alert came from, use new SPSite(ahp.siteId).

Tags : contentbug

Tiltt
Best approach to segregate custom alert templates?
"This command changes the alert template to the one you specify for all web applications on the server. "

I have also run into this issue. From what I'm reading here I gather there are 2 possibilities:
1) use code as suggested in this thread to add filter
2) create a custom list type and make a custom alert for it by copying one of the standard alert sections, renaming it to the custom list type and altering as desired.

Are there arguments for which is better (or which should be avoided)?

GauravMahajan
Do not modify the existing alerttemplates.xml - create a new one
To avoid the change to be effected to all web applications on the server, do not modify the default alerttemplates.xml file. Instead create a new xml file for your web application and activate to the desired site collection. This way the default alert template will still be valid for the remaining web applications on your server.
Thanks!

Pesche
Running this command changes the alerttemplate for all the web apps
This command changes the alert template FOR ALL web applications on the server.

Page view tracker