
Hello Rocktim Rajkumar,
Thank you for reaching out to the Microsoft Q&A Community. I understand you're experiencing an issue where the Graph API endpoint /me/messages/{id} is returning a 404 error for certain users, while working correctly for others. I am happy to assist you with that.
The issue you're encountering with the Graph API returning 404 for /me/messages/{id} on specific users is likely due to their mailboxes being hosted on-premises in a hybrid Exchange setup, where Graph API access is not supported (deprecated since July 2023). The message ID generation via Office.js is correct for Exchange Online, but Graph can't access on-prem mailboxes, resulting in the error.
To determine eligibility and handle reliably:
- Check Office.context.mailbox.restUrl in your code—if defined, the mailbox supports Graph/REST; otherwise, fall back to EWS.
- Example code for detection:
if (Office.context.mailbox.restUrl) {
// Use Graph with converted REST ID
} else {
// Fallback to EWS with original itemId and makeEwsRequestAsync
}
- Long-term: Migrate affected mailboxes to Exchange Online for full Graph support.
For more details, see Microsoft docs on Graph limitations for hybrid environments. If this doesn't resolve it, share the full error response body. I’d be happy to assist further.
If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.