MFCMAPI as a Code Sample
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
On the MFCMAPI page, click the Home tab.
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.
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 (184.108.40.2069). This lets you run the sample. However, in order to debug the sample and to examine the source, you must download the source files.
On the Source Code tab, read the license agreement and then click I Agree.
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.
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.
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.
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.
In Visual Studio 2008, click File, select Open, and then click Project/Solution.
Browse to the location where you saved the sample, click MFCMapi.vcproj, and then click Open.
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.
On the Build menu, click Build Solution.
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::OnDisplayReceiveFolderTablein the MsgStoreDlg.cpp file.