MFCMAPI as a Code Sample

This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This page may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.

The MFCMAPI sample uses the Messaging API to provide access to MAPI stores through a graphical user interface. After you download this sample, you can use the source files to examine example usage cases for many of the MAPI interfaces and references. For more information, see MAPI Interfaces.


Microsoft Visual Studio 2008 to compile for Windows Vista, Windows Server 2008, Windows XP SP2, and Windows Server 2003 SP1

To download MFCMAPI

  1. On the MFCMAPI page, click the Home tab.

  2. Click Click here to download the latest (<date> Release) build of MFCMAPI on the Home page. <date> indicates the date of the most current release, for example, October 2008 Release.

  3. On the Releases tab, under Release Notes, click source.


    To optionally download the executable of MFCMAPI sample, click Mfcmapi executable - <date> (<release number>), for example, Mfcmapi executable – October 2008 ( This lets you run the sample. However, in order to debug the sample and to examine the source, you must download the source files.

  4. On the Source Code tab, read the license agreement and then click I Agree.

  5. On the File Download dialog box, click Save. On the Save As dialog box, locate the folder in which you want to save the source files and then click Save.

  6. On the Download Complete dialog box, click Open Folder. You can also click Close to close the dialog box and locate the zipped source files in the folder that you saved them in.

  7. Right-click the MFCMAPI-<version number> and then click Extract All. On the dialog box that appears, click Extract to extract the files to the folder that is displayed. You can also click Browse to select or create a different folder.

  8. Run Visual Studio 2008 as an administrator.


    If your computer is running Windows XP, you must be logged in as an Administrator. If your computer is running Windows Vista, you must be logged in as an Administrator and you must right-click the Visual Studio 2008 icon and click Run as administrator.

  9. In Visual Studio 2008, click File, select Open, and then click Project/Solution.

  10. Browse to the location where you saved the sample, click MFCMapi.vcproj, and then click Open.

  11. On Visual Studio Conversion Wizard, click Next to convert the source files to be Visual Studio 2008 compatible. In the following pages, follow the instructions and complete the conversion. For more information, see Visual Studio Conversion Wizard.

  12. On the Build menu, click Build Solution.

  13. In the Save File As dialog box, click Save.

To use MFCMAPI as a code sample

  • In Solution Explorer, expand MFCMapi project and examine the files in the Header Files, Resource Files and Source Files for programming scenarios.

  • Many method topics in the MAPI Interfaces section point to MFCMAPI source files for programming examples. For example, in IMsgStore::GetReceiveFolderTable you are instructed to look at the function CMsgStoreDlg::OnDisplayReceiveFolderTable in the MsgStoreDlg.cpp file.