How to fix MailboxNotEnabledForRESTAPI

asdfasfawfwfwf 40 Reputation points
2024-04-18T10:21:56.6666667+00:00

Dear Team, I'm developing an application that requires access to a mailbox enabled for the Outlook REST API. We need a developer preview account to test our app's functionality, especially for creating online meetings, booking the host and recipient's calendar and sending invitations. For now I try to access calendar or events api  i.e.  https://graph.microsoft.com/v1.0/me/calendarview https://graph.microsoft.com/v1.0/me/events then I get this issue:

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

I got to know that my mailbox has not yet been enabled for the Outlook REST API. Could you please provide instructions on how to remove this issue ?

Outlook
Outlook
A family of Microsoft email and calendar products.
2,986 questions
Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
10,614 questions
Microsoft Teams Development
Microsoft Teams Development
Microsoft Teams: A Microsoft customizable chat-based workspace.Development: The process of researching, productizing, and refining new or existing technologies.
2,857 questions
0 comments No comments
{count} votes

Accepted answer
  1. Faery Fu-MSFT 16,921 Reputation points Microsoft Vendor
    2024-04-24T01:22:13.6+00:00

    Hi @asdfasfawfwfwf

    Thanks for your feedback above which shared more information and glad to know that your issue is resolved now! Since our forum has the policy that the question author cannot accept their own answer. They can only accept answers by others, and according to the scenario introduced here: Answering your own questions on Microsoft Q&A

    I would make a brief summary of this post so that other forum members could easily find useful information here:

    [Activating lagged copies - Summary]

    Issue Symptom:

    How to fix MailboxNotEnabledForRESTAPI error.

    Solution:

    Mailbox requires a valid M365 license (Exchange Online) assignment.

    To get a valid Microsoft 365 (formerly Office 365) license that includes Exchange Online for a mailbox, you typically follow these steps:

    1. Purchase Microsoft 365 License: If you don't already have a Microsoft 365 subscription, you'll need to purchase one from Microsoft or a certified reseller. You can choose a plan that includes Exchange Online, such as Microsoft 365 Business Basic, Microsoft 365 Business Standard, or Microsoft 365 Enterprise plans.
    2. Assign License to User: Once you have the Microsoft 365 license, you can assign it to the user whose mailbox you want to enable for Exchange Online. Here's how:
      • Go to the Microsoft 365 admin center (admin.microsoft.com) and sign in with your admin credentials.
      • In the admin center, go to the "Users" or "Active users" section.
      • Find the user for whom you want to enable Exchange Online (the mailbox user).
      • Select the user, and then click on "Edit" or "Product licenses" (the wording may vary depending on the admin center's version).
      • In the license assignment window, check the box for the Microsoft 365 license that includes Exchange Online (e.g., Microsoft 365 Business Basic, Microsoft 365 Business Standard).
      • Save the changes.
    3. Verify Mailbox Setup: After assigning the license, the mailbox should be automatically set up for Exchange Online. You can verify this by checking the user's mailbox settings in the Microsoft 365 admin center or by accessing the Exchange admin center.

    You could "Accept Answer" for this summary to close this thread, and your action would be helpful to other users who encounter the same issue and read this thread. Thanks for your understanding!

    0 comments No comments

2 additional answers

Sort by: Most helpful
  1. Andy David - MVP 142.2K Reputation points MVP
    2024-04-18T10:57:06.6833333+00:00

    Hi this means there is no mailbox in 365:

    https://learn.microsoft.com/en-us/exchange/troubleshoot/user-and-shared-mailboxes/rest-api-is-not-yet-supported-for-this-mailbox-error

    So it needs to created and licensed or moved from on-prem to 365.


  2. Faery Fu-MSFT 16,921 Reputation points Microsoft Vendor
    2024-04-19T08:50:03.26+00:00

    Hi @asdfasfawfwfwf ,

    Even with a subscription, you still need to ensure that your application is properly registered and authenticated, and that the mailbox you're trying to access is enabled for the REST API.

    Here are the key steps you need to follow:

    1. Register your application: You need to register your application to use the Outlook REST API. This involves identifying your app for Outlook.com and Office 365.
    2. Authenticate your application: Implement the API calls in your app and get authorization from the user at runtime.
    3. Enable the mailbox for REST API: The mailbox you're trying to access needs to be enabled for the REST API. If it's not, you'll need to ask the Administrator to enable it.
    4. Migrate mailbox data: If the mailbox is inactive or soft-deleted, you might need to ask the Administrator to migrate the mailbox data.

    Here are some articles for your reference:

    https://learn.microsoft.com/en-us/outlook/rest/

    https://learn.microsoft.com/en-us/outlook/rest/get-started

    https://learn.microsoft.com/en-us/office/dev/add-ins/outlook/use-rest-api


    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.