FAQ - Frequently Asked Questions

When to use the MAPI Stub

Why would I use this library?
Can't I just use the 64 bit mapi32.lib that ships in the Microsoft SDK?
I explicitly link to MAPI. Do I need this library?
Doesn't this library just load the MAPI stub from the system directory?
My program depends on the MAPICDO download, the Exchange implementation of MAPI. Can I use this library?
My application is only 32 bit and uses mapi32.lib. Do I have to switch to this library?
Do you have a list of new functions linked from this library that aren't available in mapi32.lib?

Linking and building

Can I just include the source of this library in my project?
Where are the instructions for building this library?
What about instructions for linking to it?
Why do I have to build this? Why can't I just download a pre-built .lib?
I use a compiler other than Visual Studio, or a different version of Visual Studio than one of the provided projects. What can I do?

Bugs

I don't like the way the library does X. Can I change it?
The MAPI Stub Library doesn't export the function X. Can I add it?
The MAPI Stub Library exports the function X incorrectly. Can I fix it?

Didn't find what you're looking for here? Start a thread on the discussion board.

Why would I use this library?

For years, MAPI was implemented as a 32 bit API. We provided a library, mapi32.lib, which programs could link to in order to get access to MAPI. Then along came Outlook 2010 and 64 bit MAPI. Since mapi32.lib was a 32 bit library, 64 bit programs needed something else in order to use MAPI. This project fills that gap. For more information, read this writeup, which also discusses a 64 bit implementation of mapi32.lib which should be avoided:
http://blogs.msdn.com/b/stephen_griffin/archive/2009/07/21/mapi32-lib-and-64-bit-mapi-programs.aspx

Can't I just use the 64 bit mapi32.lib that ships in the Microsoft SDK?

No - this is a bad implementation which doesn't locate MAPI properly and doesn't link to some MAPI functions correctly. It should be avoided.

I explicitly link to MAPI. Do I need this library?

No, but you could look at eliminating your explicit linking code by linking to this library.

Doesn't this library just load the MAPI stub from the system directory?

No, though that is a fallback mechanism. This library implements the technique discussed in How to: Choose a Specific Version of MAPI to Load to find Outlook's implementation of MAPI first. Only if this fails does it try the stub from the system directory.

My program depends on the MAPICDO download, the Exchange implementation of MAPI. Can I use this library?

Of course! This is one of the scenarios we tested and the primary reason we fall back to the stub in the system directory, which is the perferred way to load Exchange's MAPI.

My application is only 32 bit and uses mapi32.lib. Do I have to switch to this library?

No, but doing so will give you better support for loading Outlook's MAPI in a wider variety of locales. It will also eliminate the need to write LoadLibrary/GetProcAddess code to handle newer exports which are included in this library but are not included in mapi32.lib.

Do you have a list of new functions linked from this library that aren't available in mapi32.lib?

Here's a partial list:
GetDefCachedMode
HrGetGALFromEmsmdbUID
HrOpenOfflineObj
MAPICrashRecovery
OpenStreamOnFileW
WrapCompressedRTFStreamEx

Can I just include the source of this library in my project?

Yes! This is exactly how MFCMAPI does it. Read more at Directly Including the MAPI Stub Library.

Where are the instructions for building this library?

Here: Building the MAPI Stub Library.

What about instructions for linking to it?

Here: Linking To MAPIStubLibrary.lib.

Why do I have to build this? Why can't I just download a pre-built .lib?

By providing full source and build projects for this library, we're giving complete control to the developer who uses it. This way, you're not dependent on us to provide new builds to correct any issues which may be uncovered in the library. Also, this gives the developer the flexibility to add and remove features from the library to fit their specific needs. This release mechanism does build in an assumption that the developer using this library is comfortable building a C++ project, but that's a safe assumption if they're already using MAPI.

I use a compiler other than Visual Studio, or a different version of Visual Studio than one of the provided projects. What can I do?

You should still be able to use the provided source. You'll just have to build your own project or directly include the source in your existing project. Feel free to share your experiences under the Discussions tab.

I don't like the way the library does X. Can I change it?

Of course. Do whatever you like to the code. If you find bugs you wish to report, please visit the Issue Tracker tab.

The MAPI Stub Library doesn't export the function X. Can I add it?

Yes. There are plenty of examples in MapiStubLibrary.cpp of how to export a function. If the function is one we've documented, please file "Missing Export" bug under the Issue Tracker so we can consider adding it for everyone.

The MAPI Stub Library exports the function X incorrectly. Can I fix it?

Yes. You can correct the export in MapiStubLibrary.cpp. Please also file an "Incorrect Export" bug under the Issue Tracker so we can consider fixing it for everyone.

Last edited May 19, 2011 at 3:39 PM by sgriffin, version 13

Comments

No comments yet.