Graph API - Send Mail error - MailboxNotEnabledForRESTAPI The mailbox is either inactive, soft-deleted, or is hosted on-premise

Vojtěch Krása 16 Reputation points
2022-07-18T08:20:40.253+00:00

Hello,

I am calling graph.microsoft.com/v1.0/me/sendMail or /users/{id | userPrincipalName}/sendMail

and getting MailboxNotEnabledForRESTAPI for invited users (User type=Guest) from another tenant. They have normally working company mails and working https://outlook.office.com/mail/inbox/ so https://learn.microsoft.com/en-us/answers/questions/761931/microsoft-graph-api-throws-the-mailbox-is-either-i.html does not really apply.

It works fine from an application that belongs to the home tenant, but not from an application from a different tenant.

   {  
     "error": {  
       "code": "MailboxNotEnabledForRESTAPI",  
       "message": "The mailbox is either inactive, soft-deleted, or is hosted on-premise.",  
       "innerError": {  
         "date": "2022-07-18T05:31:14",  
         "request-id": "198d3758-f69c-449f-acbe-895b2be8fe2f",  
         "client-request-id": "198d3758-f69c-449f-acbe-895b2be8fe2f"  
       }  
     }  
   }  

Different user, in a different app, this time it is a multi-tenant app:

   {  
     "error": {  
       "code": "MailboxNotEnabledForRESTAPI",  
       "message": "The mailbox is either inactive, soft-deleted, or is hosted on-premise.",  
       "innerError": {  
         "date": "2022-07-05T09:36:03",  
         "request-id": "a7dafdd7-50c9-48e2-9e57-1a84fbf73009",  
         "client-request-id": "a7dafdd7-50c9-48e2-9e57-1a84fbf73009"  
       }  
     }  
   }  

Could someone diagnose this?

Thanks.

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
12,468 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Zehui Yao_MSFT 5,866 Reputation points
    2022-07-20T06:44:35.313+00:00

    Hi, and according to my tests, if your user type is guest, you can change the {tenant} value to common or consumers, so that your account will be authenticated on behalf of the personal account.
    222519-untitled.png
    Since the sendMail endpoint currently supports the use of personal permissions, you can use your personal account to use the sendMail feature to send emails to users within your tenant.
    Hope this helps you.
    222592-untitled2.png


    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.

    1 person found this answer helpful.

Your answer

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