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.