Error while opening address book. Error Code: 0x00040380 (MAPI_W_ERRORS_RETURNED)

Error while opening address book. Error Code: 0x00040380 (MAPI_W_ERRORS_RETURNED)

If you get the following error in the Application Event log:

The AgendaX Update Service reported the following error:
General Error - Output: Error while opening address book.
Error Code: 0x00040380 (MAPI_W_ERRORS_RETURNED)
Description: The connection to Microsoft Exchange is unavailable. Outlook must be online or connected to complete this action.
MAPI was unable to load the information service EMSMDB.DLL. Be sure the service is correctly installed and configured..

and you are connecting to Office 365, please follow the steps below to solve this problem:

Add the following keys to the registry, logged-in with the user that is used to run the AgendaX Update Service:


EnableADAL (DWORD) 1
DisableADALatopWAMOverride (DWORD) 1

16.0 is for Outlook 2016, 2019 and Outlook 365. If you use Outlook 2013, you have to update to Outlook 2016 or above as Microsoft does not support connections to O365 with earlier clients anymore.

Go to Control Panel / Credentials Manager / Windows Credentials and delete all credentials starting with MicrosoftOffice16_Data.

Reboot the server (not always necessary), recreate the Outlook profile that you have configured AgendaX to use, turn off Exchange Cache Mode in the profile, start Outlook with this profile, close Outlook again.

If you are prompted for username / password, please activate the checkbox 'Save password'.

After these steps, the error logged to the Application eventlog should go away.


If you continue to get this error, or if it reappears after 24 - 26 hours, your Outlook version is not capable of renewing the OAuth access token for Microsoft 365 automatically without running Outlook once per day.

We are currently looking into this problem with Microsoft, and until we have a permanent solution, downgrade to the latest version of Outlook (Version 2403, Build 17425.20146 from March 29,2024) that works and disable Outlook updates.

To do so, please do the following:

  • Stop the AgendaX Update Service
  • Download the Office deployment tool and install it in a temp folder:
  • Note: To install Build 17425.20146, you have to be subscribed in Current Chanel, but any other version in the other channels prior to 17425.20146 will also work.
  • Create a file “config.xml” in the same folder that contains the following:
<Updates Enabled="TRUE" TargetVersion="16.0.17425.20146" />
  • Start an elevated CMD.exe (Run as Administrator), change to the folder of the Office deployment tool and run:
    setup /configure config.xml
  • Run Outlook and click on File / Office account / Update options / Update now and let the installer setup the previous version of Outlook. You can close Outlook while installing.
  • Once it’s finished installing, run Outlook, click Update options / Disable updates. This section will become yellow. Close Outlook
  • Start the AgendaX Update Service and check the Application event log.

If it doesn’t work right away, stop the service, create a new Outlook profile logged-in as the user that is used to run the AgendaX Update Service, turn off Exchange Cache Mode in the profile, set the new Outlook profile name in AgendaXCfg.exe / MSX Version / Outlook profile, start Outlook with this profile and close it again, and start the AgendaX Update Service again.

This should get it back working without user intervention.

Contributions related to the subject

Would you like to write a guest post?
Please contact us.