TFSMail Add-in

If email is a part of your day-to-day work flow like it is mine, and you use Visual Studio and Team Foundation Server; then you should try this add-in I made in my spare time. It allows you to create emails based on templates that use work item fields.

alt

Create New Templates

To easily craft a new template, select the ‘Blank Template’  option to create an email that includes all the available fields and values. Fields are delimited with “??”

Create Emails From Templates

As you can see, you can right-click on a work item and pick a template name (templates should be stored in the add-in directory). The add-in will substitute the values of the work item into the email template.

The TFSMail Add-in should work for Visual Studio 2008 (I am not sure how it goes on 2010). I had a quick look around before creating this add-in and the closest thing I found was Team Companion.

In the same way that you improve the performance of your code by optimising the* lines of code that are executed often, you can get more done by optimising the tasks* that you do often during the day. Also, automating repetitive tasks might save your sanity. Also, automating repetitive tasks might save your sanity. (In case you missed it, I wrote that twice as a joke) :)

Implementation

Most of the problems I was required to solve while writing this add-in were pretty simple and are listed below.

  • Integrating with VS 2008
  • Getting fields from TFS
    • This was pretty simple and the same objects that are exposed in the TFS Client API can be obtained from VS. I created a command line version of the tool but I really wanted an add-in.
  • Creating emails using Outlook
    • The Outlook API was surprisingly simple to use for this task.
    • The functions that are used are CreateItem, CreateItemFromTemplate and Display.
  • Substituting delimited values
    • I used a regular expression to achieve this.
    • The expression needs to be non-greedy (which means it will find the first end delimiter) and it needs to search the string as a single line (otherwise an end of line character will bugger things up for you).
    • I used “??” as the delimiter so that the template can include links that have substitution fields.
    • This is the regex that does the magic:
1
System.Text.RegularExpressions.Regex("??(.+?)??", Text.RegularExpressions.RegexOptions.Singleline)

Get TFSMail
Get TFSMail Source