【问题标题】:how can i get user's calender data with microsoft graph get request如何使用 microsoft graph get request 获取用户的日历数据
【发布时间】:2021-04-21 04:21:54
【问题描述】:

我的主要目的是通过单个管理员访问令牌获取用户的日历。 我正在尝试按照以下步骤获取访问令牌。

网址:https://login.microsoftonline.com/{tenentId}/oauth2/v2.0/token正文 client_id:client_ID 范围:https://graph.microsoft.com/.default client_secret:client_secretID grant_type:client_credentials

这给了我一个访问令牌 但是当我将范围更改为范围时:https://graph.microsoft.com/Calendars.Read
它给出了错误

网址:https://login.microsoftonline.com/{tenentId}/oauth2/v2.0/token 正文 client_id:client_ID 范围:https://graph.microsoft.com/Calendars.Read client_secret:client_secretID grant_type:client_credentials

它没有返回访问令牌并说 “错误”:“无效范围”,

如果有人能提供帮助,我将非常感激。 提前致谢

【问题讨论】:

    标签: microsoft-graph-api microsoft-graph-teams microsoft-graph-mail microsoft-graph-calendar


    【解决方案1】:

    对于客户端凭据流,您需要指定应用程序权限 - Calendars.Read 并授予管理员同意。当您使用 scope:https://graph.microsoft.com/.default 时,这将获得您在创建的 Azure AD 应用程序中指定的所有权限。然后它将在您的访问令牌中包含 Calendars.Read 权限,这将允许获取用户的日历。

    https://graph.microsoft.com/v1.0/users/{user_id/UPN}/calendars
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2018-11-02
      • 2021-07-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-07-08
      相关资源
      最近更新 更多