Outlook 通知 REST API - 禁用对 OData 的访问
Outlook Notification REST API - Access to OData is disabled
我正在尝试按照此处所述使用 Outlook 通知 REST API (Microsoft Outlook Notifications REST API),但在调用订阅 REST 服务时出现错误。
我得到的回复是:
{"error":{"code":"ErrorAccessDenied","message":"Access to OData is disabled."}}
以下是我的请求header和我在请求中发送的JSONbody。
Headers:
POST https://outlook.office.com/api/v2.0/me/subscriptions HTTP/1.1
client-request-id: d138d432-9b57-409f-80de-3a5ae62cb67c
Accept: text/*, application/xml, application/json; odata.metadata=minimal
Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsIng1dCI6Ik1uQ19WWmNBVGZNNXBPWWlKSE1iYTlnb0VLWSIsImtpZCI6Ik1uQ19WWmNBVGZNNXBPWWlKSE1iYTlnb0VLWSJ9.eyJhdWQiOiJodHRwczovL291dGxvb2sub2ZmaWNlMzY1LmNvbS8iLCJpc3MiOiJodHRwczovL3N0cy53aW5kb3dzLm5ldC9jNTEyZmZkMS01ODFkLTRkYzAtYTY3Mi1mYWVlMzJmNjM4N2MvIiwiaWF0IjoxNDUwODg0MDIxLCJuYmYiOjE0NTA4ODQwMjEsImV4cCI6MTQ1MDg4NzkyMSwiYWNyIjoiMSIsImFtciI6WyJwd2QiXSwiYXBwaWQiOiJkMTM4ZDQzMi05YjU3LTQwOWYtODBkZS0zYTVhZTYyY2I2N2MiLCJhcHBpZGFjciI6IjEiLCJmYW1pbHlfbmFtZSI6IkpvcmRhbiIsImdpdmVuX25hbWUiOiJLYXRpZSIsImlwYWRkciI6IjY4LjE4Ny4xMDcuMjE4IiwibmFtZSI6IkthdGllIEpvcmRhbiIsIm9pZCI6ImQwZmFlNWRmLTc5NmEtNDc4Ny1hZDcxLTVhMDFjY2EyMWM3YiIsInB1aWQiOiIxMDAzM0ZGRjg5MzE5QTYzIiwic2NwIjoiQ2FsZW5kYXJzLlJlYWRXcml0ZSBDb250YWN0cy5SZWFkV3JpdGUgTWFpbC5SZWFkV3JpdGUiLCJzdWIiOiJrQ1FtSkpWY2ZSY3ljTjZVY2t2Z29NWVVmb09YcU9mSHpsWllLQnRsLWdvIiwidGlkIjoiYzUxMmZmZDEtNTgxZC00ZGMwLWE2NzItZmFlZTMyZjYzODdjIiwidW5pcXVlX25hbWUiOiJLYXRpZUpAb2F1dGhwbGF5Lm9ubWljcm9zb2Z0LmNvbSIsInVwbiI6IkthdGllSkBvYXV0aHBsYXkub25taWNyb3NvZnQuY29tIiwidmVyIjoiMS4wIn0.G2OLoOYbN_WhnhXSwwwgbpjcBJxnZcUYaFvKdFicuIB1h6SxcnfKye27jXnte1c9z33CYA-adzGU0yNem6y45KdPTuOF5FuctBlyBaFU0QFOq3Q1iYS0IEwkyAXy242BpXSFojMlnnAmOJLyNiE47zDV46Omw7wzD0TPGXsOZFVePUumBni81_7J_n-nwut075oXf02uU7CIt1k5Hs2FsQLJyCL6WdjSK7SkJGfeuY4RPtuNhB9WyJa82z45OZlpzz188eJpTGt5l99ou_8_oxyRH_qeHdCbmyK6llG-4LkNwhJP_bzQIVLVbkzV10SnQ8WTqfjoL5y6LFto1IRJ5Q
User-Agent: RestSharp/105.2.3.0
Content-Type: application/json
Host: outlook.office.com
Content-Length: 291
Accept-Encoding: gzip, deflate
{
"@odata.type": "#Microsoft.OutlookServices.PushSubscription",
"Resource": "https://outlook.office.com/api/v2.0/me/messages",
"NotificationURL": "http://*****.net/Outlook/Notifications",
"ChangeType": "Created",
"ClientState": "36228645-58b5-4d73-98a6-1b9ac535680f"
}
下面是我从 REST 服务收到的响应,包括 headers:
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=EDBPITZ7TEECEWYFG31KGA; expires=Thu, 22-Dec-2016 15:25:29 GMT; path=/; secure; HttpOnly
Set-Cookie: exchangecookie=3c51c6fccc55495697be99b4847c5c0b; expires=Fri, 23-Dec-2016 15:25:29 GMT; path=/; HttpOnly
Set-Cookie: ClientId=EDBPITZ7TEECEWYFG31KGA; expires=Thu, 22-Dec-2016 15:25:29 GMT; path=/; secure; HttpOnly
request-id: dd22c3f3-a88f-44e4-8308-e419efbdc2e3
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-MSEdge-Ref: Ref A: 84C683CD88D342739FD51653EF47C087 Ref B: D96A9648900FF06347DE5298F4D86287 Ref C: Wed Dec 23 07:25:29 2015 PST
Date: Wed, 23 Dec 2015 15:25:29 GMT
4f
{"error":{"code":"ErrorAccessDenied","message":"Access to OData is disabled."}}
0
我有点卡在这一点上了。我有一个有效的访问令牌,我是否正在使用沙盒用户来尝试测试它(从 https://oauthplay.azurewebsites.net/ 检索到的测试用户)。不知道还能尝试什么。感谢您提供的任何帮助!
沙盒用户(及其对应的邮箱)仅限于沙盒网络应用程序。请尝试其他用户并检查是否出现相同的错误。
我正在尝试按照此处所述使用 Outlook 通知 REST API (Microsoft Outlook Notifications REST API),但在调用订阅 REST 服务时出现错误。
我得到的回复是:
{"error":{"code":"ErrorAccessDenied","message":"Access to OData is disabled."}}
以下是我的请求header和我在请求中发送的JSONbody。
Headers:
POST https://outlook.office.com/api/v2.0/me/subscriptions HTTP/1.1
client-request-id: d138d432-9b57-409f-80de-3a5ae62cb67c
Accept: text/*, application/xml, application/json; odata.metadata=minimal
Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsIng1dCI6Ik1uQ19WWmNBVGZNNXBPWWlKSE1iYTlnb0VLWSIsImtpZCI6Ik1uQ19WWmNBVGZNNXBPWWlKSE1iYTlnb0VLWSJ9.eyJhdWQiOiJodHRwczovL291dGxvb2sub2ZmaWNlMzY1LmNvbS8iLCJpc3Mi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PtuNhB9WyJa82z45OZlpzz188eJpTGt5l99ou_8_oxyRH_qeHdCbmyK6llG-4LkNwhJP_bzQIVLVbkzV10SnQ8WTqfjoL5y6LFto1IRJ5Q
User-Agent: RestSharp/105.2.3.0
Content-Type: application/json
Host: outlook.office.com
Content-Length: 291
Accept-Encoding: gzip, deflate
{
"@odata.type": "#Microsoft.OutlookServices.PushSubscription",
"Resource": "https://outlook.office.com/api/v2.0/me/messages",
"NotificationURL": "http://*****.net/Outlook/Notifications",
"ChangeType": "Created",
"ClientState": "36228645-58b5-4d73-98a6-1b9ac535680f"
}
下面是我从 REST 服务收到的响应,包括 headers:
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=EDBPITZ7TEECEWYFG31KGA; expires=Thu, 22-Dec-2016 15:25:29 GMT; path=/; secure; HttpOnly
Set-Cookie: exchangecookie=3c51c6fccc55495697be99b4847c5c0b; expires=Fri, 23-Dec-2016 15:25:29 GMT; path=/; HttpOnly
Set-Cookie: ClientId=EDBPITZ7TEECEWYFG31KGA; expires=Thu, 22-Dec-2016 15:25:29 GMT; path=/; secure; HttpOnly
request-id: dd22c3f3-a88f-44e4-8308-e419efbdc2e3
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-MSEdge-Ref: Ref A: 84C683CD88D342739FD51653EF47C087 Ref B: D96A9648900FF06347DE5298F4D86287 Ref C: Wed Dec 23 07:25:29 2015 PST
Date: Wed, 23 Dec 2015 15:25:29 GMT
4f
{"error":{"code":"ErrorAccessDenied","message":"Access to OData is disabled."}}
0
我有点卡在这一点上了。我有一个有效的访问令牌,我是否正在使用沙盒用户来尝试测试它(从 https://oauthplay.azurewebsites.net/ 检索到的测试用户)。不知道还能尝试什么。感谢您提供的任何帮助!
沙盒用户(及其对应的邮箱)仅限于沙盒网络应用程序。请尝试其他用户并检查是否出现相同的错误。