首页 > 解决方案 > MS Teams 集成和 Microsoft Graph API - 调用事件 API 列表日历时出错 (/me/calendars)

问题描述

我正在尝试将 MS Teams API 集成到 Web 应用程序中。首先,我试图使用 Postman 的 MS API 来查看工作流程。

在 Azure UI 上,我成功创建了一个 App-Registration:我有我的ClientIDTenantID并且我还创建了客户端密码

我从https://github.com/microsoftgraph/microsoftgraph-postman-collections下载了 Postman API ,我可以检索App-Only Access token

我在一个组中创建了两个用户,并将他们登录到 MS Teams 应用程序,他们可以聊天。

我还可以获得用户访问令牌和端点,例如

  1. https://graph.microsoft.com/v1.0/users
  2. https://graph.microsoft.com/v1.0/me
  3. ETC..

工作正常。

我将用户访问令牌作为请求的承载令牌传递。

这些是我提供的 API 权限: 在此处输入图像描述

我在文件夹事件中遇到端点问题,例如:

  1. https://graph.microsoft.com/beta/me/findRooms
  2. https://graph.microsoft.com/v1.0/me/calendars
  3. ETC..

他们都给出了同样的错误:

{
   "error":{
      "code":"NoUserFoundWithGivenClaims",
      "message":"The user specified by the user-context in the token does not exist.",
      "innerError":{
         "oAuthEventOperationId":"08e3abc3-3fdf-4d85-849d-7632ac0723d2",
         "oAuthEventcV":"CGW24oLIeEW1qoscgMIMTw.1.1",
         "errorUrl":"https://aka.ms/autherrors#error-InvalidUser",
         "requestId":"8e6cb242-17fe-4a94-8c89-912606578fb3",
         "date":"2021-03-09T12:04:27"
      }
   }
} 

我没有发现任何关于这个错误的信息。有人能帮我吗?谢谢。

标签: azuremicrosoft-graph-apimicrosoft-graph-teamsmicrosoft-graph-calendar

解决方案


您可以通过将其放入 jwt.ms 来检查您的不记名令牌,并查看您是否具有“scp”声明中所需的权限。

如果你得到了,MailboxNotEnabledForRESTAPI那么你需要检查你是否有适当的交换许可证。

您可以通过进入Microsoft 管理中心-> 用户 -> 活动用户 -> 选择您的用户 -> 许可证来添加许可证


推荐阅读