I was tasked to customize the email that was sent out when an alert has been set up to send an email on a work item changed event in Team Foundation Server 2012 (TFS2012). The customization was to add a static link to the work item, which is actually a good lead into doing more advanced customizations on the email template files (XSL files).
On the application tier of TFS2012 you will need to locate the WorkItemChangedEvent.xsl file. This is what builds the email that is sent out if there is an alert set up for a work item change. You can locate this file at:
C:\Program Files\Microsoft Team Foundation Server 11.0\Application Tier\TFSJobAgent\Transforms\1033
There is a plain text version of the file, but I prefer to edit XML-based documents in Visual Studio, so go ahead and open it up in the editor of your choice. Because hyperlinks are used in a lot of the email templates there is already an XSL template for displaying an HTML hyperlink in alert email. Here is the snippet of code to add a hyperlink to Bing.
<xsl:call-template name="link"> <xsl:with-param name="format" select="'html'"/> <xsl:with-param name="link" select="'http://www.bing.com'"/> <xsl:with-param name="displayText" select="'Bing'"/> </xsl:call-template>
Below I added the highlighted snippet of code just above the footer in the work item changed event XSL document.
Note that I also put an HTML break tag in there. I added this so that it separates from the table that is defined just above it in the document. After changing this, you should not have to recycle, or restart, IIS as it should be automatically picked up. Once saved, I created a simple alert to send an email whenever there is a work item changed event on the FabrikamFiber project of the Brian Keller virtual machine and created a new task. Below is what the email looks like after my customization.