Graph Developer: Microsoft Graph API fails with error RESTAPINotEnabledForComponentSharedMailbox

One of my customer tried accessing the Graph/REST API call using Microsoft Graph API in their mailbox and they get error “RESTAPINotEnabledForComponentSharedMailbox”. It worked for their couple of other mailboxes, but failed for this given mailbox.
Their error stack (detailed one) looked like the following:




        "message": "The user's mailbox must be on Exchange



            "date": "2018-06-12T11:03:36"




During our research we found the mailbox is not an Office 365 mailbox. It turned out to be a mailbox which was residing in an Exchange on-premise server.

Please note:
- So if you see this error make sure where the given mailbox is located {Exchange on-premises or Office 365 mailbox}
- Validate the given mailbox is indeed available or not.
- Make sure that the given user mailbox must be on Exchange Online.
- You can use autodiscover to figure out where the mailbox is.
- Please do the above said sanity checks before you do any digging!!
Happy troubleshooting!!