none
Outlook 365, error 8000FFFF (unexpected) when retrieving MAPI session RRS feed

  • Question

  • I've been maintaining a legacy C++ project for some years using VS2012, it consists of an add-in to Outlook, and an out-of-process COM server.  The server needs a MAPI session and Outlook's session (pMarshalledMAPISession) and the Outlook application (pMarshalledOutlookApplication) are marshalled to it.

    This bit of code is used to get a MAPI session object that it can use:

    pMarshalledMAPISession->QueryInterface( IID_IMAPISession, (LPVOID*) &pMAPISession );
    

    There is nothing special here, and it has worked with Outlook, 2007, 2010, 2013, 2016.  What is happening with Outlook 365, is that the call to QueryInterface() is returning 8000FFFF (unexpected error).  I've tried getting the session from the Outlook application like this:

    Outlook::_ApplicationPtr outlookApplication = nullptr;
    Outlook::_NameSpacePtr outlookMAPISession = nullptr;
    IUnknownPtr lpUnkMAPISession = nullptr;
    LPUNKNOWN lpMAPISessionDisp = nullptr;
    
    outlookApplication = pMarshalledOutlookApplication;
    outlookApplication->get_Session(&outlookMAPISession);
    hr = outlookMAPISession->get_MAPIOBJECT(&lpUnkMAPISession);
    hr = lpUnkMAPISession->QueryInterface(IID_IMAPISession, (void**)&lpMAPISessionDisp);

    Again, this code works with previous versions of Outlook, but the the final call to QueryInterface() fails with error 8000FFFF on Outlook 365.  Using the currently active Outlook.Application object gives the same result.

    Is there a kind saint who could tell me how to get a MAPI session, usable in the OOP server, from the Outlook application? Please excuse the scrappy, non-homogenous samples, the code is mid-tinker.

    Wednesday, March 18, 2020 12:50 PM

All replies

  • That is in your standalone exe, right? Make sure you call MAPIInitialize on the main thread and *and* also on the thread where you call that code (if the two are different).

    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.5 is now available!

    Wednesday, March 18, 2020 4:43 PM
  • Yes, it is in the standalone exe.  Yes, MAPIInitialize is called and this code is in the main thread.  It is solely with Outlook 365 that the call to QueryInterface(IID_IMAPISession) fails, previous versions of Outlook work perfectly well.

    Thursday, March 19, 2020 8:05 AM
  • Do you have more than one machine where this happens? Have you tried to reinstall Outlook?

    I have seen cases where the registry keys responsible for MAPI marshaling are deleted, and reinstalling outlook recreates these keys.


    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.5 is now available!

    Sunday, March 22, 2020 11:02 PM
  • It happens with every Outlook 365 installation.  The CTR fix is being applied, does that contain the registry keys necessary for marshalling?
    Monday, March 23, 2020 7:44 AM