The Microsoft Foundation Classes MAPI (MFCMAPI) sample demonstrates a wide variety of Extended MAPI coding techniques.
MFCMAPI began as a learning project to see what was possible with MAPI, and over time, the learning project has developed into a sample MAPI client that is on a par with the Mdbvu32.exe utility.
The MFCMAPI user interface can display all the folders and the subfolders that are in any message store. It can also display any address book that is loaded in a profile.
A Microsoft Visual C++ Microsoft Foundation Classes (MFC) project, MFCMAPI is designed as a series of MFC dialog boxes that implement a directory hierarchy in the left pane and a property list in the right pane. Every dialog box has a number of menu items that you can use to act upon the active items. This includes an empty test function that you can use to host test code. For details on the dialog boxes and their corresponding classes, see the Readme.txt file that is included with the project.
To download the latest version of MFCMAPI, visit the following Web site:
MFCMAPI has been renamed Microsoft Exchange Server Messaging API (MAPI) Editor, and is now available for download as a tool for Microsoft Exchange Server. For more information about Exchange Server tools, visit the following Microsoft Web site:
To download MAPI Editor, visit the following Microsoft Web site:
Generic MAPI functions
Most of the following functions are contained in the MAPIFunctions.cpp file:
- AddTestAddress - Adds a hard-coded one-off address to a message.
- ConcatSPropTagArrays - Takes two SPropTagArrays and combines them.
- CopySBinary - Copies one SBinary to another to handle memory management.
- CopyLargeNamedPropertyToDebugOutput - Demonstrates how to read a large named MAPI property by using IStream.
- CopyBodyToLargeNamedProperty - Demonstrates how to write a large named MAPI property by using PR_BODY as the source.
- DeleteMessagePermanently - Deletes a message by using the DeleteMessages function.
- DeleteToDeletedItems - Uses CopyMessages to move a message to the Deleted Items folder.
- FindPropInPropTagArray - Searches an SPropTagArray for a particular property.
- LoadFromMSG - Loads an .msg file into an IMessage.
- ManualResolve - Manually resolves an address. For more information, click the following article number to view the article in the Microsoft Knowledge Base:
How to manually resolve an address book entry by using MAPI
- OpenDefaultMessageStore - Locates and opens the default message store from IMAPISession.
- OpenMessageModal - Uses PrepareForm and ShowForm to display a message.
- OpenOtherUsersMailbox - Uses HrMailboxLogon to open a mailbox.
- OpenPublicMessageStore - Locates and opens a public message store from IMAPISession.
- SaveToMSG - Saves an IMessage to an .msg file. For more information, click the following article number to view the article in the Microsoft Knowledge Base:
Save message to MSG compound file
- WriteAttachmentToFile - Saves an attachment to a file.
sample contains two implementations of the IMAPIAdviseSink
interface; one for simple new mail notification, and one for more complex table notification. Note
The directory hierarchy views in MFCMAPI do not take advantage of notifications. There is a Refresh View
menu command on the Actions
menu for most dialog boxes that use the directory hierarchy view.
MAPI Form Viewer implementation
The MAPI Form Viewer sample contains a class that implements the IMAPIMessageSite
, and IMAPIViewAdviseSink
interfaces. Together, these make for a MAPI Form Viewer implementation. The code that uses the Form Viewer is in the OpenMessageNonModal
function that is contained in the MAPIFunctions.cpp file.
For more information about another implementation of a MAPI Form Viewer, click the following article number to view the article in the Microsoft Knowledge Base:
FrmVwr.exe extended MAPI Form Viewer
Microsoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific requirements.