【发布时间】:2019-10-20 08:15:07
【问题描述】:
我正在尝试几种将 Microsoft Graph api(测试版)与 JAVA 结合使用的方法。 (我参考这个链接来连接api“https://docs.microsoft.com/en-us/graph/tutorials/java”) 而且我可以使用v1.0的所有功能,但是我不能使用beta版本。
例如,当我请求下面的代码时,他们成功返回了 JsonObject。
JsonObject response = graphClient
.customRequest("/me/calendar")
.buildRequest()
.get();
但是当我请求下面的代码时,
JsonObject response = graphClient
.customRequest("/me/findRoomLists")
.buildRequest()
.get();
他们返回以下错误
There was an unexpected error (type=Internal Server Error, status=500).
Error code: ErrorAccessDenied Error message: Access is denied. Check credentials and try again. GET https://graph.microsoft.com/beta//me/findRoomLists SdkVersion : graph-java/v1.5.0 Authorization : Bearer
我不知道是哪个问题...
我使用下面的代码来使用测试版。
// Build a Graph client
graphClient = GraphServiceClient.builder()
.authenticationProvider(authProvider)
.logger(logger)
.buildClient();
//version change 1.0 -> beta
graphClient.setServiceRoot("https://graph.microsoft.com/beta/");
这是我在 Azure 中的 API 权限。
1. Calendars.ReadWrite
2. Mail.ReadWrite
3. User.ReadBasic.All
4. User.ReadWrite
应用范围
app.scopes=User.ReadWrite,Calendars.ReadWrite,Mail.ReadWrite
我应该修改哪些内容才能使用测试版? 如果是重复的问题,我很抱歉。
【问题讨论】:
标签: java azure azure-active-directory microsoft-graph-api