Search code examples
calendarmicrosoft-graph-apilicensing

MailboxNotEnabledForRESTAPI error for few users and working for other users


I'm in the process of getting calendars of users from graph. This is my request:

GET https://graph.microsoft.com/v1.0//users/id/calendar

This is giving expected results for some users and failing for others with 404 Not found:

{

"error": {

"code": "MailboxNotEnabledForRESTAPI",

"message": "The mailbox is either inactive, soft-deleted, or is hosted on-premise.",

"innerError": {

"date": "2022-11-24T17:41:34",

"request-id": "0c24472c-a2e3-4e84-a3bb-9e35a33d06f4",

"client-request-id": "61731188-cebe-e7b3-416d-f0e4ec8c012e"

}

}

}

My tenant has Azure active directory premium P2 license. What else do I need? Why it is working for some users and failing for some users?


Solution

  • Are those user hybrid mailboxes that are on premise ? Hybrid Graph has been depreciated and will cease working in March next year https://learn.microsoft.com/en-us/graph/hybrid-rest-support

    If the users are hosted on o365 you need to verify if they have an active licence as you may find the licence has expired etc if multiple plans are (or where) active in the tenant. If a mailbox doesn't have a good licence you won't be able to access it.