MAPIInitialize() fails with MS outlook 365

Mayank Agarwal 21 Reputation points
2023-01-13T10:20:04.8566667+00:00

Hi

I have an VC++ application which reads the emails from the MS outlook.

Till now it was working fine till I was using MS outlook 2019/2016.

But as soon as I upgraded my outlook to office 365 app, my application fails with outlook.

below is the code chunk:

LPMAPISESSION			m_pSession;

MAPIINIT_0 MAPIINIT = { 0, MAPI_MULTITHREAD_NOTIFICATIONS };

	// Initialize MAPI
	flags = MAPI_NEW_SESSION | MAPI_USE_DEFAULT;
	hr = ::MAPIInitialize(&MAPIINIT);
	if (SUCCEEDED(hr))
	{
		hr = MAPILogonEx(0, NULL, NULL, flags, &m_pSession);
	};

The API which is failing is MAPIInitialize(). Now it is returning error code 127 (The specified procedure could not be found.)

Environment is Visual Studio 2019/2022, I tried with both.

Please suggest is there any change in the libraries of MAPI for outlook 365.

32-bit compilation is only I am trying to run, but I did compiled in 64-Bit, there I was getting the error "fatal error LNK1112: module machine type 'X86' conflicts with target machine type 'x64'". So I switched back to 32bit. Any idea how to get rid of this error in 64 bit compilation?

Kindly help, my application has stopped working and need guidance.

Thanks in advance.

Outlook
Outlook
A family of Microsoft email and calendar products.
3,974 questions
C++
C++
A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
3,754 questions
{count} votes

1 answer

Sort by: Most helpful
  1. RLWA32 45,691 Reputation points
    2023-01-13T11:17:17.2666667+00:00

    Perhaps you can use Stephen Griffin's MAPIStubLibrary in your project. https://github.com/stephenegriffin/MAPIStubLibrary


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.