Graph API calls to OnPremise Exchange only works in Playground

Cyr*_*lin 7 exchange-server hybrid on-premises-instances microsoft-graph-api

Our setup is an on-premise Exchange Server which is accessible over the graph api. https://docs.microsoft.com/en-us/graph/hybrid-rest-support

(https://www.msxfaq.de/cloud/graph/graph_und_exchange_onprem.htm)

We run in the issue, that our token is only "partial" working. And a token created by "Graph-Playground" is fully working. But we can't find any difference.

  • When I use Graph-Playground or use the token generated by Graph-Playground => all requests are working
  • When I create a token (over my app registration) => only some requests are working

The token seems to be valid some calls like /me are working, but all calls related to exchange like /me/contacts are failing with this error

Request, they work with token generated by Postman:**
Error:
{ "error": { "code": "MailboxNotEnabledForRESTAPI", "message": "REST API is not yet supported for this mailbox." } }

(that's a very generic error, and mostly don't say anything about the real issue)

Token Generation:

I create my token on the same way as Graph-Playground create the token (OAuth - Implicit flow):

https://login.microsoftonline.com/common/oauth2/v2.0/authorize?response_type=token&state=test2&client_id=????&scope=openid%20profile%20User.Read%20email%20Contacts.Read&redirect_uri=????

Token - Analysis:

在此处输入图片说明

As a side note, it was working for a few days, nobody changed anything :)

So I have no idea, why the "Graph Playground" can create a working token, and my token only "partially" works. Can you help me?

There is already a thread, but I'm not the owner of it. Also there are no more responses... I can't provide a bounty for a foreign thread, that's why I create a new thread. You can find it here:

MailboxNotEnabledForRESTAPI - Microsoft Graph API integration with HMA Enabled on-premise server

Ste*_*han 0

我认识到您的错误,我们在几种情况下看到了该错误(对于 Office 365):

  1. 用户没有 Exchange 许可证(可能不是这样,因为它在资源管理器中工作)。
  2. 客户租户设置了额外的安全性。

可以将应用程序限制到某些邮箱。也许您的本地 Exchange 上也有类似的某种设置或策略,您必须连接到 Exchange Online Powershell 才能设置它,所以也许您可以在那里找到一些东西。这只是一个疯狂的猜测。

为了找出这个问题,我将开始检查本地 Exchange 日志。

您是否尝试过使用/users/{upn}/calendar端点?也许只是该/me/部分不起作用。