In Part 1, we took a brief look at the fundamentals of Outlook programming. This included a quick exploration of the two primary interfaces: the full MAPI framework and the Outlook Object Model (OOM). There was also a summary of the available customization and extensibility capabilities, from custom forms and VBA macros to building COM Add-ins with Visual Studio Tools for Office (VSTO). While going “full Microsoft” can have some advantages, sometimes you have no choice but to look abroad for innovative solutions and tools to solve some major development challenges.
A common complaint with COM Add-ins built with VSTO is that they are not version-neutral. Most versions of VSTO have essentially supported “N-1”, meaning the newest version of Office and the last version of Office. So with Visual Studio 2010, you can build add-ins for Office 2010 and Office 2007. With Visual Studio 2008, there are templates for Outlook 2003 and 2007 add-ins. So there is a loss no matter which version of VSTO you use, and supporting the latest versions of Outlook only is sometimes not practical because there are still millions of installations of Outlook 2003 out there! Another problem with VSTO is deployment. While great strides have been made to simplify getting an add-in to install and be trusted when built with Visual Studio 2010, various deployment quirks regarding security policies or installing for all users still makes using previous versions a bit of a nightmare for many developers.
Thankfully, VSTO isn’t the only tool available out there, and Add-in Express offers an alternative. Add-in Express 2010 for Microsoft Office and .NET provides project templates for Visual Studio 2005, 2008 and 2010 (and even Delphi/VCL) that greatly simplify building COM Add-ins for all Office applications (plus support for Excel XLLs, RTDs and UDFs and even Office Smart Tags). One key advantage with Add-in Express add-ins is that they can be version neutral, so that they run on all versions of Office from 2000 and up. Setup and deployment is also made very easy, and there are a wide variety of wizards and designers for customizing menus, toolbars, Ribbons, Task Panes, forms, windows, options and property pages, etc.
Where Add-in Express really shines is with their Regions technology for Outlook. With VSTO, you can only add custom .NET Windows Forms to Task Panes that can only be docked to four areas. Add-in Express has their own implementation of Task Panes as well for both Explorers (the main Outlook window) and Inspectors (item windows), but allow you to customize thirteen additional areas of an Explorer: the Navigation Pane, Reading Pane (cover it or add a region to all four sides), Folder view pane (cover it or add a region to all four sides), the ToDo bar and the Web View (also known as folder home pages). These regions are even better than VSTO Task Panes in that they can be hidden, resized, minimized, they remember their state and they can be dragged and “drop-docked” to other locations. It’s simply an amazing tool for building captivating and interactive interfaces for Outlook.
For developers who have existing VSTO solution projects and would like to take advantage of these Regions, Add-in Express just recently released Add-in Express Regions for Microsoft Outlook and VSTO. Once installed, developers can simply choose “ADX Region for Outlook and VSTO” in the Add New Item dialog in Visual Studio, step through a wizard that generates some implementation code for you, then start designing.
Aside from all these great development tools for Visual Studio, there are two other essential utilities for programmers and IT Pros alike. The first is Outlook Spy. This tool is really just an add-in for Outlook, but it provides fast and convenient access to all Outlook Object Model objects, lets you examine values of all object properties, directly call functions, browse the object hierarchy and even monitor Outlook events. The tool basically shines at letting us peek under the hood and see what’s going on deep in the depths of Extended MAPI. You can use it as an ad-hoc developer reference, simple code tester or even install it on a customer PC to help find obscure problems that are difficult to trace.
When free is a must, or if installing an add-in or even trial software is forbidden, then the next best thing will have to do. That would be MFCMAPI. As the web description aptly states, “MFCMAPI uses Microsoft's published APIs to provide access to MAPI stores through a graphical user interface. Its purpose is to facilitate investigation of Exchange and Outlook issues and to provide developers with a canonical sample for MAPI development”. It’s essentially a stand-alone application that does just what Outlook Spy does but that some people find is not as intuitive to use.
Lastly, one of the more interesting solutions available for Outlook and Exchange developers is Redemption. Written by the same creator of Outlook Spy (long-time Outlook MVP Dmitry Streblechenko), Redemption is like mixing both OOM and Extended MAPI into one easy to use library. Its inception in 2001 was primarily to give developers a way to code around the Outlook Security Patch that popped up those annoying dialogs to users when code tried to send an e-mail or access the address book, among other things. Since then it has grown to provide a full replacement to CDO (an older API that was similar to OOM and offered some features usually only available with Extended MAPI, but had serious deployment issues) with RDO (Redemption Data Objects). Many developers use Redemption in VSTO or Add-in Express add-in projects to use objects, methods, properties and events not exposed to OOM and usually only possible with MAPI. Redemption is also the only messaging API that’s practical (and supported) to use for building Windows Service Applications that are often used for 24/7 mailbox processing/monitoring, batch operations or synchronization solutions.
So there you have it – one quick walk around the Outlook framework block and a good peek into the toolboxes to see what’s out there. Whatever you use or choose, don’t worry – be MAPI! (yes, I know it’s old…)