VSTO for Outlook 2007 - New Features, More Fun (part 1)
Introduction
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.
Screenshots
(For the sake of politeness I've blacked out most of my inbox. Do not be alarmed. Don't try to adjust your sets)
5 Comments
Comments have been disabled for this content.
Musa said
Hi, downloaded the c# project file but it's not loading any context menu in outlook 2007. Any idea/ thoughts?
Bean said
I hardly leave a response, however after reading through some of the responses on VSTO for Outlook 2007 - New Features, More Fun (part 1) - Miscellaneous Debris. I do have 2 questions for you if it's allright. Could it be simply me or does it look like like a few of the comments look like they are written by brain dead individuals? :-P And, if you are writing on other sites, I'd like to follow everything fresh you have to post. Would you list of all of all your social networking sites like your twitter feed, Facebook page or linkedin profile?
Beamon said
Wonderful goods from you, man. I have understand your stuff previous to and you're just extremely great. I actually like what you've acquired here, really like what you are stating and the way in which you say it. You make it entertaining and you still care for to keep it wise. I can't wait to read far more from you. This is really a wonderful site.
Hilton said
Its not my first time to pay a quick visit this web page, i am visiting this web site dailly and take nice information from here all the time.
Victor said
Very nice article, totally what I wanted to find.