MFCMAPI - Microsoft MAPI inspection tool
repository·main·Indexed 21 days ago
https://github.com/microsoft/mfcmapiA utility for accessing MAPI stores used to troubleshoot Exchange and Outlook issues and serve as a reference sample for MAPI development. It provides capabilities for managing MAPI profiles, inspecting MAPI properties, and interacting with message stores. The tool includes a command-line interface (MrMAPI), support for add-in development via DLLs, and a sample project, CreateOutlookItemsAddin, for creating Outlook items.
What's inside MFCMAPI
- MFCMAPI is a tool that provides access to MAPI (Messaging Application Programming Interface) stores. It is primarily used to facilitate the investigation of Exchange and Outlook issues and serves as a reference implementation/sample for developers performing MAPI development.
Official MFCMAPI Resources and Documentation
mainFor official documentation, code samples, and core project information, refer to the following resources:
- Home Page: MFCMAPI - Home
- MAPI Code Samples: MFCMAPI is used to demonstrate MAPI client code. See MFCMAPI as a Code Sample.
- MAPI Internals: For deep technical insights into MAPI, consult SGriffin's MAPI Internals.
Capabilities of CreateOutlookItemsAddin
mainThe
CreateOutlookItemsAddinproject provides implementations for creating the following Outlook items using MAPI:- Contacts (available in version 1.0)
- Recurring Appointments (available in version 2.0)
- Recurring Tasks (available in version 2.0)
- Mail Items (creation and sending, available in version 2.0)
Locate Fuzzing Artifacts
mainWhen the fuzzer discovers a crash or a hang, it automatically saves the specific input file that triggered the issue to thefuzz/artifacts/directory. These files are essential for reproducing and debugging the discovered bugs.Generate the Fuzzing Corpus
mainThe fuzzer requires binary input files. Since unit test data is stored as hex strings in
.datfiles, you must run the corpus builder to convert them. This command reads fromUnitTest/SmartViewTestData/In/*.datand writes the resulting binary files tofuzz/corpus/.Note: You must run this step before fuzzing, as the
fuzz/corpus/directory is not created automatically.npm run fuzz:corpusDownload the CreateOutlookItemsAddin sample project
mainThe
CreateOutlookItemsAddinproject is sample code designed to demonstrate how to use MAPI to create various Outlook items. It is based on the MSDN technical article Using MAPI to Create Outlook 2007 Items.Download: CreateOutlookItemsAddin.zipBuild the Fuzz Configuration
mainYou can build the fuzz configuration using either the command line or Visual Studio.
Command Line:
npm run build:fuzzVisual Studio:
- Open
MFCMapi.slnin Visual Studio 2026. - Select Fuzz from the Solution Configurations dropdown.
- Build the solution.
- Open
Quick Start for Fuzzing MFCMAPI
mainTo begin fuzzing MFCMAPI, you must follow a three-step sequence: generate the binary corpus from hex data, build the fuzz configuration, and then execute the fuzzer. This process uses
libFuzzerand requires Visual Studio 2026 with the Fuzz build configuration and PowerShell.# 1. Generate the corpus (converts hex test data to binary) npm run fuzz:corpus # 2. Build the fuzz configuration npm run build:fuzz # 3. Run the fuzzer npm run fuzzTroubleshoot Hidden or Missing Folders and Items
mainMFCMAPI can be used to locate and manage items that are not visible in the standard Outlook interface. Common use cases include:
- Locating Hidden Folders: Accessing folders that exist in the Exchange hierarchy but are hidden from the Outlook folder pane.
- Recovering Missing Folders: Identifying and restoring folders that have disappeared from the user view.
- Deleting Stuck Messages: Using MFCMAPI to force-delete hidden or 'stuck' messages that cannot be removed via standard Outlook commands.
- Investigating IPM_SUBTREE: Troubleshooting vanishing emails by inspecting the
IPM_SUBTREEstructure.
Run the Fuzzer
mainThe fuzzer runs for a default of 60 seconds. You can execute it via VS Code, Visual Studio, or the Command Line.
From VS Code
- Run
pwsh .\fuzz\Build-FuzzingCorpus.ps1(if not already done). - Open the Run and Debug panel (Ctrl+Shift+D).
- Select "Fuzz (x64)" or "Fuzz (x86)" from the configuration dropdown.
- Press F5 to start.
To change the runtime in VS Code, edit the selected fuzz entry in
.vscode/launch.jsonand update the"-MaxTotalTime", "60"arguments.From Command Line
Use
npm run fuzzfor the default architecture or specify x86:npm run fuzz # or npm run fuzz:x86To specify a custom runtime (in seconds) via the command line, pass the
-MaxTotalTimeargument:npm run fuzz:x64 -- -MaxTotalTime 300 npm run fuzz:x86 -- -MaxTotalTime 120From Visual Studio
- Open
MFCMapi.slnin Visual Studio. - Select the
fuzz/x64project (orfuzz/x86). - Press F5 to run.
npm run fuzz:x64 -- -MaxTotalTime 300- Run
Manage Junk Mail Folders
mainIf the standard Junk Email folder is behaving unexpectedly or is missing, MFCMAPI can be used to perform manual repairs or 'hard way' fixes to the folder structure.Troubleshoot OWA (Outlook Web Access) Issues
mainUse MFCMAPI to investigate problems occurring in the web-based client, including:
- OWA Signatures: Managing or deleting OWA signatures that are generated with broken HTML code.
- Access Restrictions: Investigating corrupt restriction filter data that prevents OWA access.
- Configuration Settings: Understanding how OWA configuration settings interact with the underlying MAPI structure.