简体   繁体   English

使用 Nodejs 通过 Microsoft Graph 访问日历事件

[英]Access calendar events with Microsoft Graph using Nodejs

I am trying to access Outlook Calendar events endpoint From the following graph API app, with the following permissions Calendar.read & Calendar.ReadWrite我正在尝试访问 Outlook 日历事件端点 从下图 API 应用程序,具有以下权限 Calendar.read 和 Calendar.ReadWrite

I am getting below Error: { "error": { "code": "OrganizationFromTenantGuidNotFound", "message": "The tenant for tenant guid '2491fc8b-6fab-41bb-90be-759045024960' does not exist.", "innerError": { "request-id": "1653871f-32b8-4e0e-9fe3-dbefdfee4638", "date": "2020-04-29T04:06:48" } } }我得到以下错误:{“错误”:{“代码”:“OrganizationFromTenantGuidNotFound”,“消息”:“租户guid'2491fc8b-6fab-41bb-90be-759045024960'的租户不存在。”,“innerError” :{“请求ID”:“1653871f-32b8-4e0e-9fe3-dbefdfee4638”,“日期”:“2020-04-29T04:06:48”}}}

在此处输入图像描述

The issue was caused by the Azure AD doesn't have O365 subscription.该问题是由 Azure AD 没有 O365 订阅引起的。 I created an Azure AD tenant which doesn't have O365 subscription and got the same error with yours.我创建了一个没有 O365 订阅的 Azure AD 租户,并且与您的错误相同。

Apart from this, if you resolve the O365 subscription problem later, you still need to do some change on your request.除此之外,如果您稍后解决 O365 订阅问题,您仍然需要对您的请求进行一些更改。 According to the screenshots you provided, you get the access token by "client_credentials" grant flow, so the access token is application identity but not user identity.根据您提供的屏幕截图,您通过“client_credentials”授权流程获取访问令牌,因此访问令牌是应用程序身份而不是用户身份。 So you can't use me in your graph api https://graph.microsoft.com/v1.0/me/events .所以你不能在你的图表中使用me api https://graph.microsoft.com/v1.0/me/events We should request the graph api by:我们应该通过以下方式请求图表 api:

https://graph.microsoft.com/v1.0/users/{id | userPrincipalName}/events

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM