azure - 如何从 Office REST API 访问共享日历?

标签 azure calendar office365 microsoft-graph-api outlook-restapi

这个问题已被问过多次,答案如 this似乎 API 直到最近才支持此功能 here其中提到有允许访问共享日历的新范围。但它仍然不起作用。

我已在两个平台上对此进行了测试:Azure 和 Microsoft Graph

  1. Azure 广告应用

我在 Azure AD 中的应用程序拥有所有必需的权限: enter image description here

enter image description here enter image description here

我调用 Office API v.1.0:

Authorise URL:

https://login.microsoftonline.com/common/oauth2/authorize?client_id=%1$s&redirect_uri=%2$s&response_type=code

Token URL: https://login.microsoftonline.com/common/oauth2/token

Calendars URL: https://outlook.office.com/api/v1.0/Me/Calendars

它只提供当前登录/授权用户创建的日历。

由于这不起作用,我尝试使用 API 的版本 2,但得到以下结果:

Additional technical information:
Correlation ID: 7abf370a-d918-4514-bd74-cf5fc93fe3cf
Timestamp: 2016-10-31 09:32:06Z
AADSTS70001: Application 'f7571710-84e2-4444-8bfe-5eef92f4a46d' is not supported for this API version.

所以我尝试使用 Microsoft Graph 应用程序

  • Microsoft Graph 应用
  • 我的应用程序还包含所有必需的权限。

    enter image description here

    我调用 Office API v2.0 的方式为:

    Authorize URL:

    https://login.microsoftonline.com/common/oauth2/v2.0/authorize?client_id=%1$s&redirect_uri=%2$s&response_type=code&scope=%3$s
    

    Where scopes are:

    private static $scopes = array(
        'https://outlook.office.com/calendars.read',
        'https://outlook.office.com/calendars.readwrite',
        'https://outlook.office.com/calendars.read.shared',
        'https://outlook.office.com/calendars.readwrite.shared',
    );
    

    Token URL: https://login.microsoftonline.com/common/oauth2/v2.0/token

    Calendars URL: https://outlook.office.com/api/v2.0/Me/Calendars

    再次没有给我共享日历。

    感谢任何帮助。

    最佳答案

    这里发生了很多事情:)然而,这里的关键似乎是你期待 /Me/Calendars包括共享日历。它不是。为了访问其他人已共享的日历,您必须通过 /Users/<id>/Calendars/ 访问网址。

    例如,如果 [email protected]登录,然后[email protected]与他分享了他的日历,然后:

    • /Me/Calendars只会显示 Bob 邮箱中的日历
    • /Users/<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="f3919a9f9fb3909c9d879c809cdd909c9e" rel="noreferrer noopener nofollow">[email protected]</a>/Calendars将显示 Bill 与 Bob 共享的日历

    更新:我们这边似乎存在阻塞问题。我们正在努力。

    关于azure - 如何从 Office REST API 访问共享日历?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40381513/

    相关文章:

    Azure混合连接 "No such host is known"

    azure - 在 Azure 中每天记录一个文件

    azure - 文档数据库 : get all documents of same entity type

    css - 如何在 ionic 中实现自定义日历?

    java - HSQLDB:使用 java 插入/获取日期

    Azure管道在构建过程中替换json键值

    ajax - 是否可以在没有监听器的情况下在 bean 中传递日历新日期?

    vb.net - 在没有签名证书的情况下部署 VSTO 加载项?

    office365 - Office 365 邮件统计

    office365 - 如何从 URL 打开 OWA 中的特定电子邮件项目