"MailboxNotEnabledForRESTAPI" error on personal Microsoft Account when trying to retrieve contacts from it

Kenya-West 6 Reputation points
2023-11-28T11:32:35.5866667+00:00

Hi! I am relatively new for building Azure apps but I have developer background.

I am currently trying to implement getting contacts from my own personal Microsoft account inside a script. For debugging purposes I first try Graph API in Postman.

I have done all steps required for this:

  1. Created Azure account;
  2. Created Entra ID app, granted Contacts.Read permission, accepted this permission as administrator. I sticked with Application permission, not Delegated;
  3. Read Microsoft Graph API basics;
  4. Imported Postman collection;
  5. Got user id of my own account;
  6. Authenticated, got JWT token;
  7. Tried to get contacts from my account by the following endpoint:

https://graph.microsoft.com/v1.0/users/<userPrincipalName>/contacts?$filter=startswith(givenName, <some string query>)

The problem

The request above returns error:

{
    "error": {
        "code": "MailboxNotEnabledForRESTAPI",
        "message": "The mailbox is either inactive, soft-deleted, or is hosted on-premise."
    }
}

Why does this error happen? It is a personal Microsoft Account. Cloud one, of course. Outlook works for this, no shadow ban, no restrictions.

P. S. Also, Power Automate (cloud) retrieves contacts successfully. As far as I know, it leverages the same API.

P. P. S. Get a closer look to user in Microsoft Entra dashboard:

2023-11-28_17-22-29

Microsoft Security | Microsoft Entra | Microsoft Entra ID
Microsoft Security | Microsoft Graph
0 comments No comments

1 answer

Sort by: Oldest
  1. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.

    1 deleted comment

    Comments have been turned off. Learn more

Your answer

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