Automatic email notifications when a work item is assigned

A common request in Team System shops is for an automatic email notification when a work item is assigned to someone. In other words, when you assign work to Joe, you want him to get a "tickler" in the form of an email that lets him know he has some new work on his plate. We can't always assume that people are diligently checking their work queues, after all.

This isn't a built-in feature of Team System, however, it's relatively easy to set up. Mariano Szklanny even has a work item email notification solution for us. I downloaded Mariano's solution and set it up here at Vertigo with some modifications to make it simpler and easier to understand.

First, you'll need to set up the web service. Unzip the solution to a new folder within the existing Team Foundation Server webservices on your web tier. That path is:

C:\Program Files\Microsoft Visual Studio 2005 Team Foundation Server\Web Services

I already have our Team System Continuous Integration web service set up there, so it's logical to set this up side-by-side in the same location, as it's doing something very similar. After unzipping, don't forget to make the folder an application in IIS manager. I left it in the DefaultAppPool, but you could change that if you want.

Now you'll need to modify the web.config for the solution with appropriate values for your site:

<appSettings>
    <
add key="MailAddressFrom" value="teamsystem@yourdomain.com"/>
    <
add key="MailFromName" value="Team Foundation Server"/>
    <
add key="SMTPServer" value="mail.yourdomain.com"/>
    <
add key="MailXSL" value="WorkItemChangedEvent.xsl"/>
    <
add key="LogFileName" value="AssignedToMailSender-log.txt"/>
    <
add key="SMTPPassword" value=""/>
    <
add key="SMTPUser" value=""/>
</
appSettings>

Next, you'll need to use the bissubscribe utility to subscribe to the WorkItemChanged event. This utility is available in the web tier in this folder:

C:\Program Files\Microsoft Visual Studio 2005 Team Foundation Server\TF Setup

bissubscribe /eventType WorkItemChangedEvent 
   /address http://teamsystem:8080/assignedtomailsender/service.asmx 
   /server http://teamsystem:8080

Use the correct URLs for the Team System server and the service installation path on your system, of course:

Once you've subscribed the web service to the WorkItemChanged event, you can assign a work item to yourself. Note that it must be assigned from another identity; assignments from yourself to yourself do not result in an email, for hopefully obvious reasons! After the assignment, you should automatically get an email:

I have enabled quick-and-dirty logging in the web service. If you don't get an email, check the c:\windows\temp folder on the Team Foundation Server web tier, and there should be a log file named AssignedToMailSender-log.txt in there with some diagnostic info about what the web service is seeing and doing. Feel free to edit the Service.cs class to add more logging if you need deeper troubleshooting.

posted on Thursday, July 13, 2006 1:39 PM by jatwood

Comments

# Automatic email notifications when a work item is assigned

Jeff Atwood (Vertigo Software) has been busy with TFS and has posted an entry on his blog today on how...
Thursday, July 13, 2006 2:59 PM by My VSTS Blog

# re: Automatic email notifications when a work item is assigned

Out of the box, individuals can sign themselves up for work item alerts in Visual Studio (with Team Foundation Explorer installed) by going to Team -> Alerts, checking the work item alert, and filling in their email address.

If you want to add a subscription for someone else, you can use bissubscribe to create the subscription for them (http://blogs.msdn.com/psheill/archive/2006/02/01/522386.aspx).

Am I missing something?

Buck
Thursday, July 13, 2006 4:47 PM by Buck Hodges

# re: Automatic email notifications when a work item is assigned

> Out of the box, individuals can sign themselves up for work item alerts in Visual Studio (with Team Foundation Explorer installed) by going to Team -> Alerts, checking the work item alert, and filling in their email address.

Does this apply to NEW work items assigned to you, or just CHANGED ones that you already had assigned to you? The complaint was that there's no notification when new work items are added to your queue.

From Mario's post:
--
After working with Visual Studio Team System at Southworks for some months, I noticed a common practice that some of us repeated frecuently: after creating a Work Item we use to send an email to the assigned user just with the subject: "Assigned WI #xxx".
--

If what you describe works, Buck, I guess maybe the difference is that this doesn't require ANY action on the part of the person the WI is assigned to? That is kinda nice.
Thursday, July 13, 2006 5:13 PM by Jeff Atwood

# re: Automatic email notifications when a work item is assigned

Yes, it includes new work items.

That does mean folks have to go do it. If he wanted to solve the problem without people doing anything themselves or him having a list of folks to sign up via bissubscribe, then his solution would be required.

Buck
Thursday, July 13, 2006 5:42 PM by Buck Hodges

# VSTS Links - 07/17/2006

Dave McKinstry on hints for expediting Team Build script deployment.

Roy Osherove on using Source...
Monday, July 17, 2006 11:22 AM by Team System News

# re: Automatic email notifications when a work item is assigned

Hi!

As Buck points out, similar results can be achieved with TFS Alerts. But the solution I've been working on is fully customizable and does not require users to perform any action. Once you set up the service, you can be sure that users will always recieve notifications, even for new team projects :)

Extract from my article:
"Note: In this article I explain a way of extending VSTS. Similar results of the implemented solution can be achieved using Team Foundation Alerts, anyway, my goal is to provide you with an extensible open-source solution which you can take and adapt to your needs easily. I found Team Foundation Alerts somehow difficult -if not impossible- to extend or customize, so I hope my solution will help you when dealing with notifications in Team Foundation Server."

Cheers
Tuesday, July 18, 2006 9:09 AM by Mariano Szklanny

# re: Automatic email notifications when a work item is assigned

Jeff,

I could be mistaken but I think you managed to break something during your refactor. Mariano's implementation extracts the AssignedTo node from 'ChangedFields' and does not proceed if the node is null. However your implementation extracts the node from 'CoreFields'. The result is that someone is emailed whenever ANY field on the work item is changed, not the assigned to field, and this is indeed the behaviour I have experienced when using your version.
Monday, July 24, 2006 7:09 PM by Paul Batum

# FAQ on VSTS subscriptions and common problems


I was collecting links &amp;amp; pointers to answer common questions in forums related to TFS eventing...
Wednesday, July 26, 2006 4:20 PM by Naren's Blog

# Workitem Event Subscription tool

Subscribing to the TFS Events using bissubscribe.exe is a powerful way to receive notifications for many...
Thursday, July 27, 2006 6:26 PM by My VSTS Blog

# FAQ on VSTS subscriptions and common problems


I was collecting links &amp;amp; pointers to answer common questions in forums related to TFS eventing...
Friday, July 28, 2006 10:19 AM by Naren's Blog

# re: Automatic email notifications when a work item is assigned

Quick note ... after you've created an application in IIS out of that directory, make sure you match the NTFS permissions of one of the other folders in that directory like, say, WorkItemTracking.

If you don't, you'll get the following error:

Exception: System.IO.FileLoadException
Message: Could not load file or assembly 'System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. Access is denied.

Also, be take note that if the service throws an exception (like if the "from" email address is invalid), it will show up as an Error in the Application event log with a source of "TFS Services"
Wednesday, August 02, 2006 12:02 PM by Joel Martinez

# re: Automatic email notifications when a work item is assigned

Just installed it, and works like a dream it seems. Thanks heaps. Hard to underdstand why this isn't built into TFS already!
Wednesday, August 02, 2006 9:14 PM by Bernd

# re: Automatic email notifications when a work item is assigned

When I try to register the service I get the following error:

Detailed Message: TF50220: Missing the schema for the following event type: WorkItemChangeEvent
Web Request Details
Url: http://ssadwp-tfssrv1:8080/Services/v1.0/EventService.asmx [method: POST]
User Agent: Team Foundation (BisSubscribe.exe, 8.0.50727.147)
Headers: Content-Length=573&Content-Type=text%2fxml%3b+charset%3dutf-8&Accept-Encoding=gzip&Accept-Language=en-US&Expect=100-continue&Host=ssadwp-tfssrv1%3a8080&User-Agent=Team+Foundation+(BisSubscribe.exe%2c+8.0.50727.147)&X-TFS-Version=1.0.0.0&SOAPAction=%22http%3a%2f%2fschemas.microsoft.com%2fTeamFoundation%2f2005%2f06%2fServices%2fEvents%2f03%2fSubscribeEvent%22
Path: /Services/v1.0/EventService.asmx
Local Request: True
Host Address: 10.2.0.34
User: VLAWNET\LOASRV [authentication type: NTLM]

Exception Message: TF50220: Missing the schema for the following event type: WorkItemChangeEvent (type ConfigurationErrorsException)

Exception Stack Trace: at Microsoft.TeamFoundation.Server.Event.SubscribeEventWithClassification(String userId, String eventType, String filterExpression, DeliveryPreference preferences, String classification)

Thursday, August 10, 2006 10:04 AM by Ted Broyles

# re: Automatic email notifications when a work item is assigned

I'm a dummy!!!!
It was a typo in the command line.
Thursday, August 10, 2006 10:11 AM by Ted Broyles

# re: Automatic email notifications when a work item is assigned

This does not find the user's email address in the Active Directory ... I do not know why.
Tuesday, September 05, 2006 12:45 AM by Peter Wu

# 當新的 WorkItem &amp;amp;quot;指派到您&amp;amp;quot;時,自動送出 Email 通知

Team System 原本的 Project Alert 功能,其實是很 &quot;陽春&quot; 的,理由很多 但我想應該是 很多 Founction 還來不及完成 但請先別洩氣,雖然 包裝完善的 GUI 介面還沒...
Saturday, September 16, 2006 6:53 AM by Refines.Info["Polo Lee"]

# Avoiding extra notifications when *anything* is changed

I ran into the same issue that Paul did when the project manager loaded all the WI's into Project and then only changed one. I received emails for every WI that I was assigned to.

The fix for this is easy:

Add the following method to the service:

private string GetAssignedFromName(XmlElement eventData)
{
return eventData.SelectSingleNode("CoreFields/StringFields/Field[ReferenceName='System.AssignedTo']/OldValue").InnerText;
}

Then change the ValidateEventData method to return the following:

return ((assignedName != GetChangedByName(eventData)) && (assignedName != GetAssignedFromName(eventData)));

This makes sure that the AssignedTo field actually changed before sending an email.
Thursday, October 05, 2006 1:36 PM by Tim Dallmann

# FAQ on VSTS subscriptions and common problems

I was collecting links &amp;amp; pointers to answer common questions in forums related to TFS eventing and
Thursday, October 12, 2006 5:16 PM by Naren's Blog

# TFS Email Notifications

Friday, October 27, 2006 6:47 AM by Bruce Johnson's SOA(P) Box

# re: Automatic email notifications when a work item is assigned

Is there anyway to do this with a non-domain based install?

Thanks
Wednesday, December 13, 2006 10:14 AM by Tim Hibbard

# FAQ on VSTS subscriptions and common problems

I was collecting links &amp;amp; pointers to answer common questions in forums related to TFS eventing and
Tuesday, February 06, 2007 10:55 AM by Naren's Blog

# re: Automatic email notifications when a work item is assigned

I have followed through the instructions, and corrected errors others have had, but I am stuck on a ASP.NET 2.0 Event error.
Exception Information is
Type: HttpParseException
Message: Could Not create type 'Service'
Wednesday, May 23, 2007 7:02 AM by Paul B

# re: Automatic email notifications when a work item is assigned

I've been trying to get this to work for a few days. We can definitely use this functionality. I added some logs and I see that the input parameters to the service method are null. Why ?
Wednesday, July 18, 2007 11:31 AM by mperrone@lason.com

# re: Automatic email notifications when a work item is assigned

I had this problem. I had the class in a namespace and needed to prefix the class name in service.asmx with the namespace
----------------------------------------------
I have followed through the instructions, and corrected errors others have had, but I am stuck on a ASP.NET 2.0 Event error.
Exception Information is
Type: HttpParseException
Message: Could Not create type 'Service'
Wednesday, July 18, 2007 11:35 AM by mperrone@lason.com

# ciprofloxacin drug

ciprofloxacin drug
Monday, October 01, 2007 7:01 PM by ciprofloxacin drug

# ciprofloxacin drug

ciprofloxacin drug
Monday, October 01, 2007 7:01 PM by ciprofloxacin drug

# Automated Emails from Team Foundation Server for Work Item Assignments

Automated Emails from Team Foundation Server for Work Item Assignments
Tuesday, October 23, 2007 1:40 PM by Andrea B. Williams

# FAQ on VSTS subscriptions and common problems

I was collecting links &amp;amp; pointers to answer common questions in forums related to TFS eventing and
Wednesday, January 23, 2008 9:42 AM by Naren's Blog

# FAQ on VSTS subscriptions and common problems

I was collecting links &amp;amp; pointers to answer common questions in forums related to TFS eventing and
Tuesday, July 29, 2008 5:18 AM by Naren's Blog

# Tramadol.

Buy tramadol. Tramadol.
Friday, May 29, 2009 9:34 PM by Tramadol.

# Vicodin.

Vicodin. Vicodin withdrawl. Signs of vicodin addiction. Vicodin no prescription.
Monday, June 01, 2009 7:47 PM by Vicodin.

# Vicodin and hydroxyzine.

Vicodin. How to make vicodin. Re your vicodin refill is ready. Is it safe to snort vicodin.
Wednesday, June 03, 2009 7:45 PM by Online vicodin.