David Gardiner

We've got TFS 1.0 and the latest version of TeamPlain installed.

I'd like to customise the alert emails that are generated by TFS so that the URLs to each file in a changeset links through into the TeamPlain view of the file (so that I can view the file contents online).

Is there a way to modify the URL

I'm guessing if it is possible it probably involves editing the files in C:\Program Files\Microsoft Visual Studio 2005 Team Foundation Server\Web Services\VersionControl\v1.0\Transforms

-dave


Re: Team Foundation Server - Work Item Tracking Customising alert emails to link to TeamPlain

Tiago Pascoal

I think the people in the teamplain forum should be able to help you more.

I'm not sure if teamplain use the teamplates you are referring. These templates are used in subscriptions





Re: Team Foundation Server - Work Item Tracking Customising alert emails to link to TeamPlain

David Gardiner

It's the alert subscription emails that I want to customise, so I think these are probably the right templates in question.

What I presume needs to happen is that I edit these templates in some fashion so that instead of the hyperlink in the email pointing back to a TFS web page, that it instead points to a page on the TeamPlain site.

-dave




Re: Team Foundation Server - Work Item Tracking Customising alert emails to link to TeamPlain

Leow Kah Man

I agree with Dave.

What needs to be modified is probably the XSL templates in Team Foundation Server.

I do not know exactly how to modify it though.

I have been looking for a solution to this months back, to no avail





Re: Team Foundation Server - Work Item Tracking Customising alert emails to link to TeamPlain

Tiago Pascoal

My Bad. I thought you were mentioning the possibility that teamplain has to send by email work items and such.

They you are right, all you need is to change the mentioned files.

Afaik as i know, there is no way to have a parameter with the teamplain url. So you will have to hardcode the address of the page you wish to point to.

Which event do you wish to customize





Re: Team Foundation Server - Work Item Tracking Customising alert emails to link to TeamPlain

Leow Kah Man

Pity that we cannot make it point to TeamPlain.

What if I want to make it point to:

http://xxxxx/WorkItem.aspx id=<work_item_id>

How do I do this


Thank you.




Re: Team Foundation Server - Work Item Tracking Customising alert emails to link to TeamPlain

Tiago Pascoal

This would be one way to do it.

Edit the file C:\Program Files\Microsoft Visual Studio 2005 Team Foundation Server\Web Services\Services\v1.0\Transforms\WorkItemChangedEvent.xsl.

Backup it first.

The part that contains

<xsl:when test="DisplayUrl[.!='']">
<xsl:element name="a">
<xsl:attribute name="href">
<xsl:value-of select="DisplayUrl" />
</xsl:attribute>


<xsl:when test="DisplayUrl[.!='']">
<xsl:element name="a">
<xsl:attribute name="href">http://xxxxx/WorkItem.aspx<xsl:text disable-output-escaping="yes">&amp;</xsl:text>id=<xsl:value-of select="CoreFields/IntegerFields/Field[ReferenceName='System.Id']/NewValue"/></xsl:attribute>


Don't forget to replace the bold part with your teamplain server name.

I'm not 100% sure about this, but i think a iisreset is needed on the application tier server.

This is not perfect since the URL of the teamplain is hardcoded, but it's better than nothing. :-)

This will probably get overwritten on a SP install or an upgrade

Let me know if this was good enough for you.






Re: Team Foundation Server - Work Item Tracking Customising alert emails to link to TeamPlain

Tiago Pascoal

It ocurred to me that as long as your teamplain is installed on the application data tier it is also possible to do this without hardcoding the server url.

Just replace

<xsl:value-of select="DisplayUrl" />

with:

<xsl:value-of select="concat(substring-before(DisplayUrl,':8080/WorkItemTracking/WorkItem.aspx artifactMoniker='),'/WorkItem.aspx id=',substring-after(DisplayUrl,'artifactMoniker='))" />


This assumes teamplain is running on port 80 if its not, just place the appropriate port before /Work..... on the second parameter of the concat function.

example, suppose teamplain is on port 4040

<xsl:value-of select="concat(substring-before(DisplayUrl,':8080/WorkItemTracking/WorkItem.aspx artifactMoniker='),':4040/WorkItem.aspx id=',substring-after(DisplayUrl,'artifactMoniker='))" />


It also assumes teamplain is running on HTTP, if it's running on HTTPS its a matter of doing another string substitution with http for https

Hope this helps.





Re: Team Foundation Server - Work Item Tracking Customising alert emails to link to TeamPlain

Leow Kah Man

Tiago Pascoal wrote:
This would be one way to do it.

Edit the file C:\Program Files\Microsoft Visual Studio 2005 Team Foundation Server\Web Services\Services\v1.0\Transforms\WorkItemChangedEvent.xsl.

Backup it first.

The part that contains

<xsl:when test="DisplayUrl[.!='']">
<xsl:element name="a">
<xsl:attribute name="href">
<xsl:value-of select="DisplayUrl" />
</xsl:attribute>


<xsl:when test="DisplayUrl[.!='']">
<xsl:element name="a">
<xsl:attribute name="href">http://xxxxx/WorkItem.aspx<xsl:text disable-output-escaping="yes">&amp;</xsl:text>id=<xsl:value-of select="CoreFields/IntegerFields/Field[ReferenceName='System.Id']/NewValue"/></xsl:attribute>


Don't forget to replace the bold part with your teamplain server name.

I'm not 100% sure about this, but i think a iisreset is needed on the application tier server.

This is not perfect since the URL of the teamplain is hardcoded, but it's better than nothing. :-)

This will probably get overwritten on a SP install or an upgrade

Let me know if this was good enough for you.



Many thanks for your help.

Just a minor correction proposal:
&amp; = &,
It should be a question mark ( ) instead.





Re: Team Foundation Server - Work Item Tracking Customising alert emails to link to TeamPlain

Djewst

Tiago Pascoal wrote:
It ocurred to me that as long as your teamplain is installed on the application data tier it is also possible to do this without hardcoding the server url.

Just replace

<xsl:value-of select="DisplayUrl" />

with:

<xsl:value-of select="concat(substring-before(DisplayUrl,':8080/WorkItemTracking/WorkItem.aspx artifactMoniker='),'/WorkItem.aspx id=',substring-after(DisplayUrl,'artifactMoniker='))" />


This assumes teamplain is running on port 80 if its not, just place the appropriate port before /Work..... on the second parameter of the concat function.

example, suppose teamplain is on port 4040

<xsl:value-of select="concat(substring-before(DisplayUrl,':8080/WorkItemTracking/WorkItem.aspx artifactMoniker='),':4040/WorkItem.aspx id=',substring-after(DisplayUrl,'artifactMoniker='))" />


It also assumes teamplain is running on HTTP, if it's running on HTTPS its a matter of doing another string substitution with http for https

Hope this helps.

I don't think this is entirely correct.

The entry should be:

<xsl:value-of select="concat(substring-before(DisplayUrl,':8080/WorkItemTracking/WorkItem.aspx artifactMoniker='),':4040/UI/Pages/WorkItems/WorkItemEdit.aspx id=',substring-after(DisplayUrl,'artifactMoniker='))" />


Note though that you must already have an active session on teamplain or else you might get a "You are not logged in or session is expired." message.





Re: Team Foundation Server - Work Item Tracking Customising alert emails to link to TeamPlain

Tiago Pascoal

UI/Pages/ Why

On teamplain 1.0 the supplied solution works.

Unless the URLs have changed in the newly release power tool.

Haven't installed it yet.





Re: Team Foundation Server - Work Item Tracking Customising alert emails to link to TeamPlain

Djewst

Oh yes, I used teamplain 2.0 so perhaps that could be the case. Your solution didn't work for me, but above changes made it work for version 2.

In which case this thread now contains a solution for both versions





Re: Team Foundation Server - Work Item Tracking Customising alert emails to link to TeamPlain

Tiago Pascoal

Yep.

And according to Buck Hodges, in version 2005 of Team System Web Access the problem of acessing the work item directly and not having a session can be solved by pointing to

http://[TeamSystemWebAccessSite]/wi.aspx id=[WorkItemID]

So we still have another method. :-)

See: http://blogs.msdn.com/buckh/archive/2007/08/17/team-system-web-access-for-tfs-2005-faq.aspx





Re: Team Foundation Server - Work Item Tracking Customising alert emails to link to TeamPlain


Re: Team Foundation Server - Work Item Tracking Customising alert emails to link to TeamPlain

Tim Scott

Here's how to get the Checkin Event to link to the Changeset history in TSWA:

Edit is the Checkin event portion of TeamFoundation.xsl. Follow the previous blog post's steps, but edit TeamFoundation.xsl instead. Search for "Checkin event" in that file...it should look like:



Code Snippet
<!-- Checkin event -->
<xsl:template name="CheckinEvent">
<xsl:param name="CheckinEvent"/>
<head>
<title><xsl:value-of select="Title"/></title>
<div class="Title">
<xsl:call-template name="link">
<xsl:with-param name="format" select="'html'"/>
<xsl:with-param name="embolden" select="'true'"/>
<xsl:with-param name="fontSize" select="'larger'"/>
<xsl:with-param name="link" select="Artifacts/Artifact[@ArtifactType='Changeset']/Url"/>

Replace the <xsl:with-param name="link" part with:

Code Snippet

<xsl:with-param name="link" select="concat(substring-before(Artifacts/Artifact[@ArtifactType='Changeset']/Url,
':8080/VersionControl/Changeset.aspx artifactMoniker='),
':88/UI/Pages/Scc/ViewChangeset.aspx changeset=',
substring-after(Artifacts/Artifact[@ArtifactType='Changeset']/Url,'artifactMoniker='))"/>
<xsl:with-param name="displayText" select="ContentTitle"/>

Instead of 88, use whatever port your TSWA is running on.