To build the MAPI Stub Library as MAPIStubLibrary.lib, do the following:
You have two options to get the source code:
-
Clone the repository (recommended):
git clone https://github.com/microsoft/MAPIStubLibrary.git cd MAPIStubLibrary -
Download as ZIP: Download the latest source and extract it to a local directory.
The project includes all necessary MAPI headers in the include directory, so no additional downloads are required.
-
Open the solution: Open
mapistub.slnin Visual Studio (2019 or later recommended). -
Select configuration: From the Solution Configuration dropdown, select:
Releasefor production buildsDebugfor debugging purposes
-
Select platform: From the Solution Platform dropdown, select:
x64for 64-bit applications (recommended)Win32for 32-bit applicationsARM64for ARM64 applications
-
Build: Press
Ctrl+Shift+Bor go to Build → Build Solution.
You now have a file, MAPIStubLibrary.lib, which you can link in to your project.
The npm scripts now use MSBuild by default (and keep node-gyp scripts under gyp:*):
-
Install Node.js: Make sure you have Node.js installed.
-
Install dependencies:
npm install
-
Build with MSBuild:
Default build:
npm run build
Common build variants:
npm run build:debug:x64 # default script target npm run build:release:x64 npm run build:debug:x86 npm run build:release:x86 npm run build:debug:arm64 npm run build:release:arm64 npm run build:debug:arm64ec npm run build:release:arm64ec npm run build:all # x64 + x86 all variants
Clean build outputs:
npm run clean
-
(Optional) Build with node-gyp (legacy):
npm run gyp:build npm run gyp:build:x64 npm run gyp:build:x86 npm run gyp:build:arm64 npm run gyp:clean
MSBuild outputs go to Visual Studio configuration/platform output directories. node-gyp outputs are in architecture-specific directories:
build/lib/x64/MAPIStubLibrary.lib- 64-bit librarybuild/lib/ia32/MAPIStubLibrary.lib- 32-bit librarybuild/lib/arm64/MAPIStubLibrary.lib- ARM64 library
After building with Visual Studio, you'll find:
MAPIStubLibrary.lib- The static library for linking- Debug symbols (if building in Debug configuration)
After building with node-gyp (gyp:* scripts), you'll find:
MAPIStubLibrary.lib- The static library for linking inbuild/Release/
Both build methods produce the same MAPIStubLibrary.lib static library that you can link into your C++ projects.