如何从Office REST API访问共享日历? [英] How to access shared calendars from Office REST API?
问题描述
这个问题已经问过几次了,并且按照 this 之类的答案,似乎API不支持此问题然后直到最近为止,此处,其中提到存在允许访问共享日历的新作用域.但这仍然行不通.
This question has been asked several times and as per answers such as this it seems the API didn't support this then until recently as here which mentions that there are new scopes which allow accessing the shared calendars. But it still does not work.
我已经在两个平台上对此进行了测试:Azure和Microsoft Graph
I have tested this on two platforms: Azure and Microsoft Graph
- Azure广告应用
我在Azure AD中的应用程序具有所有必需的权限:
My application in Azure AD has all the required permissions:
我以以下方式调用Office API v.1.0:
I make a call to Office API v.1.0 as:
授权URL:
Authorise URL:
https://login.microsoftonline.com/common/oauth2/authorize?client_id=%1$s&redirect_uri=%2$s&response_type=code
令牌URL:https://login.microsoftonline.com/common/oauth2/token
日历网址:https://outlook.office.com/api/v1.0/Me/Calendars
它只给我当前登录/授权用户创建的日历.
It only gives me the calendar created by the current logged-in/authorising user.
由于此操作无效,因此我尝试使用API的版本2,但得到以下信息:
Since this didn't work, I tried with the version 2 of the API but I got the following:
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应用程序
So I tried with a Microsoft Graph Application
- Microsoft Graph App
我的应用程序还包含所有必需的权限.
My application here also contains all the required permissions.
我以以下方式调用office API v2.0:
I make call to the office API v2.0 as:
授权URL:
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
范围是:
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',
);
令牌网址:
https://login.microsoftonline.com/common/oauth2/v2.0/token
日历网址:
https://outlook.office.com/api/v2.0/Me/Calendars
再次没有给我共享日历.
Again does not give me the shared calendars.
感谢您的帮助.
推荐答案
很多事情在这里进行:)但是,这里的问题似乎在于您期望/Me/Calendars
包括共享日历.它不是.为了访问已共享的其他人的日历,您必须通过/Users/<id>/Calendars/
URL访问.
A lot of stuff going on here :) However it seems the crux here is that you're expecting /Me/Calendars
to include shared calendars. It does not. In order to access someone else's calendar that has been shared, you must access via the /Users/<id>/Calendars/
URL.
例如,如果bob@contoso.com登录并且bill@contoso.com与他共享了他的日历,则:
So for example if bob@contoso.com logs in, and bill@contoso.com has shared his calendar with him, then:
-
/Me/Calendars
仅在Bob的邮箱中显示日历 -
/Users/bill@contoso.com/Calendars
将显示Bill与Bob共享的日历
/Me/Calendars
would ONLY show calendars in Bob's mailbox/Users/bill@contoso.com/Calendars
would show calendars Bill has shared with Bob
更新:看来我们这方面存在阻止问题.我们正在努力.
Update: It seems there's a blocking issue on our side. We're working on it.
这篇关于如何从Office REST API访问共享日历?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!