Dirk Van den Berghe SharePoint Blog

real admins use stsadm, but admins from hell use powershell.

How to change the Alert Email notification message for Announcements

Yes, you all know the kind of messages I mean. I was asked yesterday if there was a way to remove some data from those announcement messages that are sent out when you have enabled alerting on a announcement list. It turns out that you can change this for about any alert in MOSS/WSS

The typical announcement message looks something like this:

Test Site

Test Item has been added

Modify my alert settings

|

View Test Item.

|

View Announcements

 
Title: Test Item   
Body: Test Body Text   
Expires: 18/01/2008   
Last Modified 7/01/2008 14:51 by System Account

Well, one of our users wanted us to remove the Title, Body and Expires Field from the mail message.

So I did a little research and found out that the place to make this change is the alerttemplates.xml file.

I was guided somewhere to the following document on the net http://www.combined-knowledge.com/Downloads/Modify_Alert_Notifications.pdf (I attached the document to this post)

Another source I used is: http://www.topxml.com/rbnews/XML/re-70019_Customizing-Alert-Notifications-and-Alert-Templates-in-Windows-SharePoint-Services-3-0.aspx

Anyway in short I ended up changing the following lines in the xml file in the <AlertTemplate Type="List" Name="SPAlertTemplateType.Announcements"> section:

from:

<Properties>       <ImmediateNotificationExcludedFields>ID;Author;Editor;Modified_x0020_By;Created_x0020_By;_UIVersionString;ContentType;TaskGroup;IsCurrent;Attachments;NumComments;</ImmediateNotificationExcludedFields>  <DigestNotificationExcludedFields>ID;Author;Editor;Modified_x0020_By;Created_x0020_By;_UIVersionString;ContentType;TaskGroup;IsCurrent;Attachments;NumComments;</DigestNotificationExcludedFields> </Properties>

to:

<Properties>
<ImmediateNotificationExcludedFields>ID;Title;Body;Expires;Author;Editor;Modified_x0020_By;Created_x0020_By;_UIVersionString;ContentType;TaskGroup;IsCurrent;Attachments;NumComments;</ImmediateNotificationExcludedFields> <DigestNotificationExcludedFields>ID;Title;Body;Expires;Author;Editor;Modified_x0020_By;Created_x0020_By;_UIVersionString;ContentType;TaskGroup;IsCurrent;Attachments;NumComments;</DigestNotificationExcludedFields> 
</Properties>

this tells SharePoint to longer show the fields Title, Body and Expires in the alert

Once edited and saved, you need to enable this as follows:

  1. copy the modifed xml into the C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\TEMPLATE\xml of every FrontEnd server in your farm
  2. execute command stsadm -o updatealerttemplates -filename <your modified xml file> -url <your site>
  3. execute iisreset on every Frontend
  4. restart the Windows Sharepoint Services Timer service 

 

Of course, if you are looking for changing some other type of alert besides Announcements, you need to make the necessary changes in the corresponding section of the xml file. The available sections are:

Alert Template Name

Description

SPAlertTemplateType.GenericList

The first alert template in Alerttemplates.xml. GenericList is used unless there is a match to one of other event types.

SPAlertTemplateType.DocumentLibrary

Notification of changes in document libraries

SPAlertTemplateType.Survey

Notification of changes in surveys

SPAlertTemplateType.Links

Notification of changes in links

SPAlertTemplateType.Announcements

Notification of changes in announcements

SPAlertTemplateType.Contacts

Notification of changes in contacts

SPAlertTemplateType.Events

Notification of changes in events

SPAlertTemplateType.Tasks

Notification of changes in tasks

SPAlertTemplateType.DiscussionBoard

Notification of changes in discussion boards

SPAlertTemplateType.PictureLibrary

Notification of changes in picture libraries

SPAlertTemplateType.XMLForm

Notification of changes in XML form

SPAlertTemplateType.DataConnectionLibrary

Notification of changes in data connection libraries

SPAlertTemplateType.AssignedtoNotification

Assigned to task / issue list notifications

 

Posted: 01-08-2008 4:16 by Dirk | with 18 comment(s)
Filed under: ,

Comments

Juan Pelaez said:

I am trying to show the item id, I test with ItemId, ID, Itemid, itemid.

I remove id from <ImmediateNotificationExcludedFields>.

May be you have any idea?

tks in advance.

# February 13, 2008 12:54 PM

Dirk said:

Hi,

removing the ID from the exception list is indeed the first step. The next step woull be to change the content section of the message to show the ID. I have tried to do so, but did not succeed.

best regards

# February 14, 2008 12:28 AM

Leo said:

Hi...

What I couldn't find out here is how I would be able to change the content of SPAlertTemplateType.AssignedtoNotification

I think I should be able to change the content somehow somewhere in the database for this... but honestly I still can't find out yet. I want to change some wording of the template. Any idea? If you know how you can email to me at leolu@live.com.sg . Thanks in advance. =)

# May 16, 2008 2:19 AM

Dirk said:

Hi Leo,

I searched a little bit around for you and found a case where 10 steps are described that may help you

1. make alerttemplates.xml a copy to the backup folder. Open the file in notepad.

2. Find the alert template you would like to modify, following OOB alert templates

are provided:

SPAlertTemplateType.GenericList : Template for alerts on Generic lists

SPAlertTemplateType.DocumentLibrary : for Document libraries

SPAlertTemplateType.Survey

SPAlertTemplateType.Links

SPAlertTemplateType.Announcements

SPAlertTemplateType.Contacts

SPAlertTemplateType.Events

SPAlertTemplateType.Tasks

SPAlertTemplateType.DiscussionBoard

SPAlertTemplateType.PictureLibrary

SPAlertTemplateType.XMLForm

SPAlertTemplateType.DataConnectionLibrary

SPAlertTemplateType.AssignedtoNotification : Assigned to Task/Issuelist

notifications

So in your case, Leo, find SPAlertTemplateType.AssignedtoNotification

3. For example. When using the SPAlertTemplateType.AssignedtoNotification, find the first occurrence of Immediate.

We will modify the immediate alert template.

4. To remove the button “Modify my alert settings”, you may remove the following

code:

<GetVar Name="MySubsUrl" URLEncodeAsURL="TRUE"/>

<HTML><CDATA>">$Resources:Alerts_link_modify;</a></td>

<td class="toolbarsep">|</td></CDATA></HTML>

5. To remove the button, view list URL, you may remove the following code:

<GetVar Name="ListUrl" URLEncodeAsURL="TRUE" />

<HTML><CDATA>">$Resources:Alerts_link_view; </CDATA></HTML><GetVar

Name="ListName" HTMLEncode="TRUE" />

6. To remove the button, Mobile view, remove the below code:

<Switch>

<Expr><GetVar Name="MobileUrl"/></Expr>

<Case Value = "NULL"/>

<Default>

<HTML><CDATA>

<td class="toolbarsep">|</td>

<td class="toolbarbutton"><a href="</CDATA></HTML><GetVar Name="MobileUrl" />

<HTML><CDATA>">$Resources:Alerts_mobile_view;</a></td></CDATA></HTML>

</Default>

</Switch>

7. Save the alerttemplates.xml file.

8. At the command line, type the following command:

> cd %commonprogramfiles%\microsoft shared\web server extensions\12\bin

> stsadm -o updatealerttemplates -url <site> <site> is the web application URL

that you would like to make alert changed.

9. Restart IIS admin Services and SharePoint Timer Services.

10. Check again if the customization meet your requirement.

# May 16, 2008 3:01 AM

bob said:

i need to hide certain info by changing alerttemplate for a SP 2007 BLOG site alert notification

i am not sure which one to change, is it Generic list or Document library or any thing else?

how to find out which template the blog site is using, is there a way to find out?

thanks

# June 23, 2008 4:12 PM

Dirk said:

Hi,

It depends on what type of list or library the alert is set on. If it is used to alert you regaring posts or comments on the Blog, then it should probably be SPAlertTemplateType.GenericList. All data in the Blog site template is stored in Lists, with the exception of the Photos, which are stored in a PictureLibrary (SPAlertTemplateType.PictureLibrary )

best regards,

Dirk

# July 4, 2008 5:42 AM

carl said:

Hello,

I created a custom workflow using visual studio.  I have it set to send an email notification when a new task is created.  This is working fine.  I attached the workflow to a document library in which users will fill out an browser enabled infopath form.  when the notification email is sent, it has a link to the item.  when that link is selected, it is opening the file in the client application.  What I have to do is to add &DefaultItemOpen=1 to the end of the url.

Do you know which template I have to modify?

I am guessing that I will have to modify the AssignedToNotification.  Could you please verify this.

Thanks

# September 9, 2008 11:36 AM

Dirk said:

Hi Carl,

my guess would be thet you will need to change the url in the SPAlertTemplateType.AssignedtoNotification

section. I cannot verify at this tim, because I am restaging my SharePoint farm at the moment and it will take a while to get it back online :). But I will check later for this.

best regards

Dirk

# September 10, 2008 2:43 AM

Kalyan said:

Hi all,

I want to change the complete content of the EmailBody which is coming from SPAlertTemplateType.AssignedtoNotification.

I able to edit the Subject of the notification but not EmailBody.

I found the code

<IfSubString>

<Expr1>0x010801</Expr1>

<Expr2><GetVar Name="RawValue#ContentTypeId"/</Expr2>

<Then><GetVar Name="RawValue#EmailBody"/></Then>

<Else>

in the XML page under Header section.

After seeing this code I thought that EmailBody Is creating somewhere else but not in the XML page.

Can someone please help me in getting the complete control over the content in the EmailBody.

And tell me how to create the URL link for the Workflow task and the NewItem was caused to raise this alert?

# January 7, 2009 4:28 AM

Kalyanpolasi said:

Hi all,

I want to change the complete content of the EmailBody which is coming from SPAlertTemplateType.AssignedtoNotification.

I able to edit the Subject of the notification but not EmailBody.

I found the code

<IfSubString>

<Expr1>0x010801</Expr1>

<Expr2><GetVar Name="RawValue#ContentTypeId"/</Expr2>

<Then><GetVar Name="RawValue#EmailBody"/></Then>

<Else>

in the XML page under Header section.

After seeing this code I thought that EmailBody Is creating somewhere else but not in the XML page.

Can someone please help me in getting the complete control over the content in the EmailBody.

And tell me how to create the URL link for the Workflow task and the NewItem was caused to raise this alert?

# January 7, 2009 5:25 AM

Dawn said:

Hopefull someone can answer?

My problem is:  Secure site workflow-generated email; when a task is overdue, it has the correct URL link listed:  "1. Review <task name>" with a URL of: <xxxxxxxx.com/.../Document Library/FY09/09 Document/090227.pdf> .

But, when they go to edit the task, the URL starts incorrectly (an "HTTP" instead of an "HTTPS").  As an example:  "3. To Edit this task

<xxxxxxxx.com/.../Document Library/FY09/09 Document/090227.pdf>/_layouts/WrkTaskIP.aspx?ID=310&List=dbd43e53-14c2-48f5-85d1-89c123c5a3d6>

to mark the task as completed."

I can't find the area of the alert that refers to the HTTP URL so I can put the correct "HTTPS" URL in instead!

Dawn

# March 16, 2009 12:12 PM

Tenille Bennett said:

Hi There, brilliant blog, I wonder if this solution can be applied to notifications sent when a workflow is executed? My SharePoint Designer workflow sends an automatic email to a groups of users telling them a task has been assigned to them. My client doesn't like the word 'assigned' and would liek it changed to 'created'. Is this possible? Thanks in advance!

# April 23, 2009 8:41 AM

Hughesdon said:

Great post!

Just wondering if you know whether 'NumComments' is the field 'Check In Comment' in a Document Library - as this is what I want to expose in the Alert.

If not, is there a full properties listing available somewhere?

Cheers

# April 26, 2009 11:00 PM

I'm small, so share nothing... said:

SharePoint :: Alert Me Template Customization

# May 6, 2009 8:20 AM

Skyrunner said:

Hello, I'm trying to get the .ExtendedProperties["Comments"] displayed on the alert email by altering the alerttemplatenotifications.xml. Any ideas how I should do it?

Thanks.

# July 30, 2009 4:27 AM

Hemendra said:

Hi ppl,

I want to add more custom fields in e-mail message. Can anyone tell me how can i do it. I am really stuck with it.

# November 18, 2009 5:01 AM

Latif said:

Hi Kalyan,

I have the same requirement as you. could you solve the problem? If you have solved the problem please tell me how have you done it.

If any once can change the mail body/details please mail me. alatif@wellmed.net or latif127@yahoo.com

# December 18, 2009 4:06 PM

epiliF said:

Can anybody help me with showing the Comments on a Document Library Template?

# May 28, 2010 5:49 PM
Leave a Comment

(required) 

(required) 

(optional)

(required)