Search code examples
exchange-servermapiexchange-online

MAPI cannot read all entries of the global address list (GAL) anymore in Exchange Online since January 2024


I have a MAPI application that uses a MAPI online profile to read all mail users of the global address list (GAL). Since January 2024 only 500 entries can be read from the GAL in Exchange Online.

The change in MAPI (on server side) seems to be related to a change for Outlook UI, see View Address Lists in Outlook.

This change seems to break third-party applications that e.g. implement a synchronization of the GAL using MAPI.

The following MAPI test program on GitHub can be used to reproduce the behavior: MAPI test. Use "mapitest.exe read-gal <online-profile>".

It works correctly with a cached MAPI profile but our application is a service that requires an online MAPI profile.

How can I use MAPI to read again all entries of the GAL?

I provided a test program to reproduce the issue. I tested the program using Microsoft® Outlook® for Microsoft 365 MSO (Version 2109 Build 16.0.14430.20314) 64-bit.

I expect that all rows can be read using MAPI also for Exchange Online using an online MAPI profile (as this seems to be the case for Exchange On-Premise). Perhaps Exchange Online provides a configuration parameter to switch back to the MAPI endpoint functionality of 2023 for reading the GAL.


Solution

  • If you are using an online profile, chances are you cannot read anything from Exchange, address book or messages - MSEMS provider needs OAuth token to talk to Exchange, and if your code is running as a service, MSEMS provider cannot access the cached token even if there is a local user who is using the same profile: the security contexts are different, hence no sharing.

    Your options are limited - either use cached profile (you can potentially end up with stale data), or run your code in an Outlook COM/VSTO addin so that you can piggyback on an existing Outlook session.