The more I use Exchange, the more I find the need to use MFCMAPI to understand what happens in mailboxes so that I can figure out how Exchange really works. It's an essential part of an administrator's toolkit, including those who work with Exchange Online in Office 365.
Microsoft, or rather the program’s author Stephen Griffin, has published an updated version of the venerable MFCMAPI utility on Codeplex. The new version is dated January 2012 and is available in both 32-bit and 64-bit variants. MFCMAPI depends on Outlook being installed on the workstation where it runs and you need to match the correct versions of Outlook and MFCMAPI before MFCMAPI can run. The current version (as shown by the version running on my 64-bit Windows 7 system is 126.96.36.1991. You can read about the latest fixes and updates on the MFCMAPI blog.
Because of its unique ability to unveil the mysteries of mailbox contents, MFCMAPI is an essential component of a serious Exchange administration toolkit. The program used to be called the “Microsoft Exchange Server Messaging API Editor”and now it's just MFCMAPI. Neither do the programjustice as its name should really be something like “Exchange Mailbox Internals Spy”.
MFCMAPI goes back to the earliest days (2001) of the utility when it began as a training exercise for Stephen Griffin to learn how to program in the Messaging Application Programming Interface (MAPI). I believe that the MFC prefix indicates that he used the Microsoft Foundation Class Library as a framework. MFC is a library that encapsulates parts of the Windows API in C++ classes and so makes it easier for programmers to work with the Windows API (or so the theory goes).
Over the past decade Stephen Griffin has done an incredible job of maintaining MFCMAPI to keep it up to date with the latest versions of Exchange, fix bugs, and add new features. This is truly a labor of love. In 2007, Microsoft placed MFCMAPI into Codeplex and you can download the program executable and source code from there.
Although Stephen has been working hard to improve MFCMAPI’s user interface, don’t expect it to work like Outlook. The advantage delivered by MFCMAPI is that it exposes mailbox internals using MAPI, so you can expect to encounter MAPI structures and names. Fortunately, it’s easy enough to figure out what’s going on but I wouldn’t attempt to make changes unless you know exactly what you are doing. Just like operating on Active Directory data with ADSIEDIT, it’s possible that you could mess things up in a mailbox if you make a change in the wrong place.
When you start MFCMAPI, you select an Outlook profile to use to connect to Exchange. MFCMAPI reads the profile data and presents a screen similar to that shown below. In this instance, you can see that a number of different mailboxes are available because they are listed in the profile, including mailboxes where I have delegate access. The mailboxes include archive mailboxes linked to the primary mailboxes. You can access on-premises andmailboxes as well as those like Hotmail that Outlook accesses via IMAP. Remember, you’re not going to send or receive email. All you do with MFCMAPI is investigate and interrogate MAPI structures within mailboxes.
Once you open a mailbox, you can navigate through its contents and navigate through the folders that Outlook displays (click on “Top of Information Store” or "IPM_Subtree" to reveal your folders). as well as those that it doesn’t, such as “Recoverable Items” and its sub-folders. The next screen shot shows that I’ve opened the Sent Items folder in a mailbox. Only one item is in the folder. You can see the MAPI properties for the message shown in the bottom pane and are able to edit many of these properties by clicking on them.
The selected property is PR_BODY, which is the body of the message or the part that appears under the header information and contains whatever content you want to communicate to the user. This is a plain text version of the message body. If the message is in HTML format, another property called PR_BODY_HTML will contain this data. Clicking on a property exposes a property editor. As shown below, you can then make whatever changes you feel appropriate and then click on OK to have MFCMAPI update the property. The example shown edits the plain text message body and if this property is updated any HTML content will also be overwritten as plain text, an example of how a change to one property might have consequences for another.
The best way to learn MFCMAPI is to run it to examine mailbox structure and contents. You might like to run the program against a test mailbox and experiment with making changes just to see what you can and cannot do (the program does prevent you making changes to some essential data) as well as the effect of making the changes. Using a test mailbox is probably better than running MFCMAPI against your own production mailbox unless you like to live life on the edge of a razor.
Apart from poking around mailboxes to learn how Exchange organizes data, when should you use MFCMAPI to solve problems? It’s hard to say. One common example is if a mailbox has become corrupt for some reason and you need to work with Microsoft support to figure out what’s going on. In this scenario, you’re likely to be told exactly what to do and will probably end up having to remove items that are suspected of being corrupt. Exchange 2010 SP1 introduced a form of Store protection in that it will isolate corrupt mailboxes and prevent users logging on to the mailboxes for six hours. Exchange might deem a mailbox to be corrupt if too many threads “freeze” when a client attempts to retrieve data. In this case, the only access to the mailbox is possible through a program such as MFCMAPI. If the user is able to identify the items that cause the freeze, you could remove them with MFCMAPI to see whether your surgery addresses the problem.
Kudos to Stephen Griffin for his continued work on MFCMAPI, a utility that is tremendously useful for all the right reasons!
Follow Tony Redmond on Twitter@12Knocksinna