TFSMail Add-in 2

Jun 3, 2010

My TFS Mail Add-in has been improved!

Features:

  • *Added template instructions *
    • Now you will know how to create new templates. The blank template command now includes instructions.
  • *Menu appears in more places *
    • Now you can right click on your currently-open work item document to get the same menu.
  • *Specify where templates should be read from *
    • Now you can specify where you want template files to be read from by editing the TFSMailTemplateDirectories.xml file.
  • Bug Fixes
    • Addressed an issue where clicking on templates in the query window would do nothing.
    • Addressed an issue where some templates that have fields that span multiple lines would not get substituted.

Incidentally, the add-in appears to work with Office 2010. One day I might get Visual Studio 2010 and be able to tell you if it works on that too.

My TFS Mail post still has the link for downloading the Add-in.

TFSMail Add-in

May 19, 2010

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.

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:
System.Text.RegularExpressions.Regex("??(.+?)??", Text.RegularExpressions.RegexOptions.Singleline)

Get TFSMail
Get TFSMail Source