简体   繁体   English

Microsoft Calendar REST API-禁用对OData的访问

[英]Microsoft Calendar REST API - Access to OData is disabled

I'm trying to access Microsoft's Outlook.com Calendar REST API. 我正在尝试访问Microsoft的Outlook.com日历REST API。 I got OAUTH2 authentication set up correctly and have a valid access token and refresh token available. 我正确设置了OAUTH2身份验证,并具有有效的访问令牌和刷新令牌。

However, if I try to access the calendar list @ https://outlook.office.com with my access token: 但是,如果我尝试使用访问令牌访问日历列表@ https://outlook.office.com

GET /api/v1.0/me/calendars HTTP/1.1
Accept: application/json; odata.metadata=none
Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciO[...]

the service returns with an 403 Forbidden 服务返回403 Forbidden

HTTP/1.1 403 Forbidden
Cache-Control: private
Transfer-Encoding: chunked
Content-Type: application/json;odata.metadata=minimal;odata.streaming=true;IEEE754Compatible=false;charset=utf-8
Server: Microsoft-IIS/8.5
Set-Cookie: ClientId=OD6KHQBTKOKMLXUI8OJEG; expires=Wed, 21-Sep-2016 18:37:21 GMT; path=/; secure; HttpOnly
Set-Cookie: exchangecookie=8e4f582170cb445780c7148e9494b293; expires=Thu, 22-Sep-2016 18:37:23 GMT; path=/; HttpOnly
Set-Cookie: ClientId=OD6KHQBTKOKMLXUI8OJEG; expires=Wed, 21-Sep-2016 18:37:21 GMT; path=/; secure; HttpOnly
request-id: 7113f37d-69e0-4f8c-a264-9f3599d47899
X-CalculatedBETarget: CY1PR08MB1801.namprd08.prod.outlook.com
X-BackEndHttpStatus: 403
OData-Version: 4.0
X-AspNet-Version: 4.0.30319
X-DiagInfo: CY1PR08MB1801
X-BEServer: CY1PR08MB1801
X-Powered-By: ASP.NET
X-FEServer: AM3PR04CA0074
X-MSEdge-Ref: Ref A: D69A31E4FAA44258B0B8C351A71D2F9E Ref B: 0D3CA60C0976F50C452293F8CF403D8C Ref C: Tue Sep 22 11:37:23 2015 PST
Date: Tue, 22 Sep 2015 18:37:22 GMT

{"error":{"code":"ErrorAccessDenied","message":"Access to OData is disabled."}}

I played around with Outlook's OAuth Sandbox , where the same request returns a 200 OK with the correct data in the body. 我使用了Outlook的OAuth Sandbox ,在该请求中,相同的请求将返回200 OK其中包含正确的数据。 Strangely enough, they spot a nice little Show me the cURL! 奇怪的是,他们发现了一个不错的小东西。 button in the sandbox, but this exact curl command will fail again with a 403 error in my terminal. 按钮,但此精确的curl命令将再次失败,并在我的终端中出现403错误。

What am I missing? 我想念什么?

I talked to a Microsoft techie. 我和微软的技术人员谈过。 My problem was, that the REST API is not public (yet) and Microsoft has not yet enabled the API for standard Outlook.com accounts. 我的问题是,REST API尚未公开(尚未),并且Microsoft尚未为标准Outlook.com帐户启用该API。

I requested an Outlook developer preview account with the REST API enabled by writing an email to outlookdev@microsoft.com 我通过向emaildev@microsoft.com发送电子邮件来请求启用了REST API的Outlook开发人员预览帐户

It took some time until I got a response from Microsoft, but using the developer account everything works now as expected. 我花了一些时间才收到Microsoft的回复,但是使用开发人员帐户,现在一切正常。

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

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