VSTO for Outlook 2007 – New Features, More Fun (part 1)


Outlook has always been a bit of a latecomer to the VSTO game, being a step behind and a version later than Word and Excel. I'm glad to see that with Outlook 2007 and VSTO 2005SE it's gotten simpler and easier to write add-ins for it. So I did.

The basic premise of this was an exercise to know more of the new Object Model enhancements in Outlook 2007, but it best serves as an example of a add-in for Outlook that uses the VSTO environment and the abilities of the new version.

The Goal

Lately I've found my inbox exploding with many new subfolders. Lots of new projects and tasks that accumulate messages and information. Since I don't subscribe (yet?) to the “Search, don't Sort” philosophy, I tend to group my correspondences into subfolders in some intricate and arcane hierarchy. Outlook 2007 gives me three methods of copying messages from my inbox to the relevant folder:

1) Rules. The problem here is that I don't always know in advance who the mail will be coming from or what will be on the subject line.

2) Drag&Drop. Necessitates keeping my folder tree open to its full depth, or else waiting for the interminable timeout until the tree expands itself. Also, no keyboard support.

3) Move To Folder dialog. This allows me select several items and move them en masse to a new folder. The problem here is that it opens a whole dialog for me to traverse (like in the Drag & Drop scenario above) until I can move my items. Move clicks, more UI to go through.

As you can see, I'm not thrilled with either one of these alternatives, so I decided to add a fourth.

The Solution

A solution that was suggested to me a while ago was, unfortunately, very hard to implement using Office 2003. The idea is to add a new menu item to an item's Context Menu in Outlook that will allow quick access to all subfolders. This will allow a two-click moving (one to raise the context menu, another to choose the destination). It also allows keyboard navigation and selection, making it easier for those times when I'm experiencing mouse fatigue.

There are some problems and limitations with my current implementation, an admittedly quick'n'dirty solution. The first is that I currently only support moving MailItems, meaning normal Outlook messages. It currently won't work for tasks, appointments or Public Folder posts. This isn't really a problem for most scenarios, but if someone needs that functionality, it should be added.

Another problem is that you can only move items to a leaf folder – if I have a Projects->Sharepoint->NewSharepointProject hierarchy, I can't copy my items to the Projects or Sharepoint folders. This is probably solvable, but I decided against confornting the Office Commandbars for now. I'll elaborate more later when I talk about the code.

The Code

This has gotten longer than I expected, so I'll be splitting the actual code of the add-in to a different post. Here's the link to the second part: The Add-in Code post.


(For the sake of politeness I've blacked out most of my inbox. Do not be alarmed. Don't try to adjust your sets)

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.