SUMMARY The Microsoft Foundation Classes MAPI (MFCMAPI) sample demonstrates a wide variety of Extended MAPI coding techniques.

MORE INFORMATION 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.

MFCMAPI can be used to view and to modify properties on any item that can be accessed by using MAPI. These properties can be saved to a disk for more advanced operations, such as“before-and-after” comparisons. The following file is available for download from the Microsoft Download Center:

http://download.microsoft.com/download/4/9/f/49f2ce91-72c5-45f5-9849-401cd9b86d67/mfcmapi_bin.exe

Release Date: February 14, 2005

For more information about how to download Microsoft support files, click the following article number to view the article in the Microsoft Knowledge Base: 119591 (http://support.microsoft.com/kb/119591/) How to obtain Microsoft support files from online services Microsoft scanned this file for viruses. Microsoft used the most current virus-detection software that was available on the date that the file was posted. The file is stored on security-enhanced servers that help prevent any unauthorized changes to the file. The following file is available for download from the Microsoft Download Center:

Mfcmapi_source.exe (http://download.microsoft.com/download/a/b/f/abff6157-765f-4416-b219-e573f092dac6/mfcmapi_source.exe) Release Date: March 7, 2005

For more information about how to download Microsoft support files, click the following article number to view the article in the Microsoft Knowledge Base: 119591 (http://support.microsoft.com/kb/119591/) How to obtain Microsoft support files from online services Microsoft scanned this file for viruses. Microsoft used the most current virus-detection software that was available on the date that the file was posted. The file is stored on security-enhanced servers that help prevent any unauthorized changes to the file.

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: http://technet.microsoft.com/en-us/exchange/bb288488.aspx (http://technet.microsoft.com/en-us/exchange/bb288488.aspx) To download MAPI Editor, visit the following Microsoft Web site: http://www.microsoft.com/downloads/details.aspx?familyid=55FDFFD7-1878-4637-9808-1E21ABB3AE37&displaylang=en (http://www.microsoft.com/downloads/details.aspx?familyid=55FDFFD7-1878-4637-9808-1E21ABB3AE37&displaylang=en) Back to the top

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: 266351 (http://support.microsoft.com/kb/266351/) 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: 171907 (http://support.microsoft.com/kb/171907/) Save message to MSG compound file • WriteAttachmentToFile - Saves an attachment to a file.

Back to the top

IMAPIAdviseSink implementation The IMAPIAdviseSink 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, IMAPIViewContext, 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: 230770 (http://support.microsoft.com/kb/230770/) 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.