question

SrenHeintzelmannTherkildsen-8546 avatar image
0 Votes"
SrenHeintzelmannTherkildsen-8546 asked SrenHeintzelmannTherkildsen-8546 commented

MailboxNotEnabledForRESTAPI issue

We have an integration that uses the GraphApi (java version) to synchronize calendar events from our application to the clients outlook calendars. We use an application client "account" created through Azure (App Registrations) with quite broad permissions like

  • Application.Read.All

  • Calendars.Read

  • Calendars.Write

  • Users.ReadWrite.All

Our client does have a hybrid setup of Microsoft 365 with on-premise 2016 exchange server, but these should have the correct Cumulative Update 3 (CU3) and the client has followed the directions here: https://techcommunity.microsoft.com/t5/exchange-team-blog/on-premises-architectural-requirements-for-the-rest-api/ba-p/605609 for setting up their environment.

Still we get error like this when trying to create calendar events in our clients calendars:

 Error code: MailboxNotEnabledForRESTAPI;Error message: The mailbox is either inactive, soft-deleted, or is hosted on-premise.;;POST https://graph.microsoft.com/v1.0/users/test@anonymized.dk/calendar/events;SdkVersion : graph-java/v1.7.1;SdkVersion : graph-java/v1.7.1;Authorization : Bearer eyJ0e...q58NIg;{"subject":"Test appointment","body":{"contentType":"html","content":"Test message"},"sensitivity":"normal","start":{"dateTime":"2021-06-08T09:47:00.000","timeZone":"Europe/Copenhagen"},"end":{"dateTime":"2021-06-08T10:09:00.000","timeZone":"Europe/Copenhagen"},"showAs":"busy","type":"singleInstance","attendees":[{"type":"required","emailAddress":{"address":"test@anonymized.dk"}}],"categories":["Cura"]};;404 : Not Found;Transfer-Encoding : chunked;Strict-Transport-Security : max-age=31536000;Cache-Control : private;x-ms-ags-diagnostic : {"ServerInfo":{"DataCenter":"West Europe","Slice":"E","Ring":"5","ScaleUnit":"000","RoleInstance":"AM1PEPF00004367"}};client-request-id : 53133a27-5409-4782-8373-126fe8b6afda;Vary : Accept-Encoding;request-id : c42a2726-12ab-4d13-a925-71f38db17924;Date : Fri, 04 Jun 2021 08:18:05 GMT;Content-Type : application/json;{;  "error": {;    "code": "MailboxNotEnabledForRESTAPI",;    "message": "The mailbox is either inactive, soft-deleted, or is hosted on-premise.",;    "innerError": {;      "date": "2021-06-04T08:18:06",;      "request-id": "c42a2726-12ab-4d13-a925-71f38db17924",;      "client-request-id": "53133a27-5409-4782-8373-126fe8b6afda";    };  };}
 com.microsoft.graph.http.GraphServiceException: Error code: MailboxNotEnabledForRESTAPI
 Error message: The mailbox is either inactive, soft-deleted, or is hosted on-premise.
 POST https://graph.microsoft.com/v1.0/users/test@anonymized.dk/calendar/events
 SdkVersion : graph-java/v1.7.1
 SdkVersion : graph-java/v1.7.1
 Authorization : Bearer eyJ0eXAiOiJKV1Qi...q58NIg
 {"subject":"Test Appointment","body":{"contentType":"html","content":"Test message"},"sensitivity":"normal","start":{"dateTime":"2021-06-08T09:47:00.000","timeZone":"Europe/Copenhagen"},"end":{"dateTime":"2021-06-08T10:09:00.000","timeZone":"Europe/Copenhagen"},"showAs":"busy","type":"singleInstance","attendees":[{"type":"required","emailAddress":{"address":"test@anonymized.dk"}}],"categories":["Cura"]}
 404 : Not Found
 Transfer-Encoding : chunked
 Strict-Transport-Security : max-age=31536000
 Cache-Control : private
 x-ms-ags-diagnostic : {"ServerInfo":{"DataCenter":"West Europe","Slice":"E","Ring":"5","ScaleUnit":"000","RoleInstance":"AM1PEPF00004367"}}
 client-request-id : 53133a27-5409-4782-8373-126fe8b6afda
 Vary : Accept-Encoding
 request-id : c42a2726-12ab-4d13-a925-71f38db17924
 Date : Fri, 04 Jun 2021 08:18:05 GMT
 Content-Type : application/json
 {
   "error": {
     "code": "MailboxNotEnabledForRESTAPI",
     "message": "The mailbox is either inactive, soft-deleted, or is hosted on-premise.",
     "innerError": {
       "date": "2021-06-04T08:18:06",
       "request-id": "c42a2726-12ab-4d13-a925-71f38db17924",
       "client-request-id": "53133a27-5409-4782-8373-126fe8b6afda"
     }
   }
 }

I have come across this blog suggesting additional changes to be done on to enable the Graph Api in a hybrid setup
https://blog.thenetw.org/2019/05/13/using-client_credentials-with-microsoft-graph-in-hybrid-exchange-setup/

Can you tell me if I am on the right track?




microsoft-graph-calendar
· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

To isolate what is causing this.
- Take a look at this doc on requirements for hybrid to see if something is missing.
- Check this thread to see if you can point issue on your scenario.
- You can also test the API with Graph Explorer to see if it works for delegated permissions and check if it only fails for on prep users.


0 Votes 0 ·

Unfortunately the people responsible for the setup of my customers MS365 environment, did not respond to my questions, so I have to give up on this issue.

I have another customer though, with a similar issue, so I opened a new questions: https://docs.microsoft.com/en-us/answers/questions/725379/unknownerror-from-microsoft-grap-api-when-trying-t.html

0 Votes 0 ·

0 Answers