Every Exchange administrator has her own collection of
utility programs to which she returns on a regular basis to solve
problems or otherwise move issues forward. ADSIEdit is an obvious
example, but others appear on an ongoing basis. In this section, I
describe two utilities that I consider worth having in your collection.
Other utilities that I like very much include the Remote Connectivity
Analyzer (RCA), which is described in depth in Microsoft Exchange 2013 Inside Out: Connectivity, Clients, and UM
by Paul Robichaux (Microsoft Press, 2013), and Microsoft’s Office
Configuration Analyzer Tool (OffCAT), available for download from http://support.microsoft.com/kb/2812744.
MFCMAPI depends on
the availability of Outlook on the workstation on which it runs, and
you need to match the correct versions of Outlook and MFCMAPI before
MFCMAPI can run. It can be run alongside both Outlook 2010 and Outlook
2013 without any problems. It’s best to run MFCMAPI when Outlook is
configured in online mode because this exposes all the mailbox contents
to MFCMAPI. Much of the more interesting mailbox contents such as the
various subfolders of the Recoverable Items folder structure are not
replicated to the PC when Outlook runs in cached Exchange mode.
MFCMAPI
began as a training exercise in 2001 for Microsoft developer Stephen
Griffin to learn how to program in the Messaging Application
Programming Interface (MAPI). 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 thus
makes it easier for programmers to work with the Windows API (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. Although
Stephen has been working to improve the MFCMAPI user interface, it does
not work like Outlook. The advantage delivered by MFCMAPI is that it
exposes mailbox internals by using MAPI, so you can expect to encounter
MAPI structures and names. It’s easy to figure out, but don’t attempt
to make changes unless you know exactly what you are doing. As when
operating on Active Directory data with ADSIEdit, it’s possible to
cause problems 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 Figure 1.
In this instance, you can see that a number of mailboxes are available
because they are listed in the profile, including mailboxes that have
delegate access. The mailboxes include archive mailboxes linked to the
primary mailboxes. The default store—the one to which Exchange delivers
email—is marked. You can access on-premises and Office 365 mailboxes
and those such as Outlook.com
that Outlook accesses through IMAP. You’re not going to send or receive
email. All you do with MFCMAPI is investigate and interrogate MAPI
structures within mailboxes.
When
you open a mailbox, you can navigate through its contents and examine
the folders Outlook displays (click Top Of Information Store to reveal
your folders) and those it doesn’t, such as Recoverable Items and its
subfolders. In Figure 2,
you can see the opened Sent Items folder in a mailbox. Twenty-eight
items are in the folder. The MAPI properties for the selected message
are shown in the bottom pane, and you view full details (or edit) many
of these properties by clicking them.
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 and the
effects of making the changes. (The program does prevent you from
making changes to some essential data.) 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 examining mailboxes to learn how Exchange organizes data, when
should you use MFCMAPI to solve problems? One common example is if a
mailbox has become corrupt for some reason, and you need to work with
Microsoft support to resolve the problem. In this scenario, you’re
likely to be told exactly what to do, and you might have to remove
items that are suspected of being corrupt. 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 can identify
the items that cause the freeze, you could remove them by using MFCMAPI
to see whether your action addresses the problem.
Exchange Web Services Editor
The
best thing about MAPI is the extensive feature set it enables for
clients such as Outlook and, in its server-side variants, Exchange
server. I guess you could argue that MAPI has been very persistent in
that the name first appeared as “simple MAPI” in Microsoft Mail way
back in the dim and distant early nineties. The functionality you can
build on the 12 functions supported by simple MAPI is barely sufficient
to create and send messages and can’t approach the kind of feature set
in Outlook 2013, but it was a start.
Powerful as it is, MAPI has
never attracted much developer enthusiasm outside Microsoft and has
been viewed as an API that should be approached only when necessary.
The lack of good documentation is one possible reason, and the result
is that only heavy-duty engineering projects, such as those to create
MAPI providers that allow Outlook to access non-Microsoft servers, have
used MAPI. (Inside MAPI [Irving De La Cruz and Irving Thaler: Microsoft Press, 1996] has been out of print for many years.)
Microsoft
has shipped many other messaging-related APIs in an attempt to make
Exchange data more accessible or usable, including esoteric offerings
such as Collaborative Data Objects (CDO) Routing (released with
Exchange Server 5.5) and WebDAV (which was supposed to be the next
great thing when Exchange Server 2000 was released). However, MAPI
remains optimal, which is why tools such as MFCMAPI remain so important.
Over
the past few years, Exchange Web Services (EWS) has transformed
matters. EWS is now the recommended API for developers who want to
access and work with the contents of the Exchange Store. Microsoft uses
EWS for clients such as Outlook 2011 for Macintosh and Outlook Web App,
and plans are in place to extend EWS further as new versions of
Exchange appear, probably to close the functionality gap between EWS
clients and the MAPI-based Outlook. As far as I am aware, no plan
exists to discard MAPI for EWS in the short-to-medium future, but this
is a possibility when EWS supports the same feature set as MAPI does
today.
In the interim, it seems that EWS is a good thing to know something about. The Exchange Web Services Editor (EWSEditor, http://ewseditor.codeplex.com/)
is another Codeplex project that’s built on top of .NET Framework 3.5.
Like MFCMAPI, versions of EWSEditor are released on a regular basis and
work with on-premises servers running Exchange 2007, Exchange 2010, or
Exchange 2013. The utility also supports Office 365. If you have
questions about how to program using EWS, you can find many examples
and advice on MVP Glen Scales’s website (http://www.gsexdev.blogspot.com/).