尝试使用带有查询的Microsoft.Office365.OutlookServices OutlookServicesClent
执行请求时,返回Microsoft.OData.Client.DataServiceQueryException
堆栈跟踪:
at Microsoft.OData.Client.DataServiceContext.InnerSynchExecute[TElement](Uri requestUri, String httpMethod, Nullable1 singleResult, OperationParameter[] operationParameters)
at Microsoft.OData.Client.DataServiceRequest.Execute[TElement](DataServiceContext context, QueryComponents queryComponents)
at Microsoft.OData.Client.DataServiceContext.Execute[TElement](Uri requestUri, String httpMethod, OperationParameter[] operationParameters)
at BL.OutlookAnalysisService.GetListOfMessagesByQuery(OutlookServicesClient service, Uri searchUri
,错误是:
Microsoft.OData.Client.DataServiceQueryException)exception).Response.Error"{\"error\":{\"code\":\"ErrorServiceUnavailable\",\"message\":\"Active Directory operation did not succeed. Try again later.\"}}"
System.Exception {Microsoft.OData.Client.DataServiceClientException}
更新
http请求:
`GET /api/v2.0/me/mailfolders/SentItems/messages?$filter=ReceivedDateTime%20ge%202016-11-22 HTTP/1.1
OData-MaxVersion: 4.0
Accept: application/json;odata.metadata=minimal
Accept-Charset: UTF-8
User-Agent: Microsoft ADO.NET Data Services
Authorization: Bearer EwAYA+l3BAAUWm1xSeJRIJK6txKjBez4GzapzqMAAfh6O0QoQEsdN6OkFbuNKi/TXNzqUKWObaTUhPeziD3SYgEvHNGDxcvME0+Tt0/L8pWBlOSkeaKEYgd3B7C7go+8pDVQGeBoHhLhrmp4zMbtbdOiDJcxRwaUJ36Ak4DpCV665COyP2tS5/zbbq9+EIBFg0TQWbdOjMqN12DJGvRR+TzgMwWDV3IE1sJzAOi5CzYM7oy1pS1JX7JBq8ZxB7+kI1tjksanXymLZ5mlRRJp+XoR73mBocIgljLRPFaovyzUzMsEuTAvZ1gbbYqqH0u+hXNrlDDsFKtKeXb8IWGYeud+WMGmZbatt4LTZTXmBFYJf9hYZdaKNBQkBbvnc4IDZgAACHKN9ak8g6O86AHAhJwa9lFr9IgY4SPRdmUHqYDC4TSr8R+RVsANy4RSFe/p90sdRZXwvFsQ4JioWsVtQ0J3Aoh9cVNOKgZg2SIqm2Ni8VHD/EXSqtZqu0KZCKFSRrRxUSdzr3oG98hhbo1DcykWWyiI9PuPBxkFT60ZjC8+1NyXiX64vDOAQ9jvNf4BpGiahfDuzWajmeDiPXMd25ohXeY6s4XX5XhWDWXrDA5CdU+n1ZyF4kzUtCvalWTCIqRQ0UOXmEqa1nWNFIC0Vb6gTZl3HJqkRZxY9X+V0qHJYZyr5Ynss+FajWxnoYqasNNGZDWlJmBeAlIcWHO4kd8ggBiBBZdl7+unO1+jJhenRV2sSFGx11DQPOzRC3DvqwMwr0iJ9ZJ6vMUrAmvT1M3+0fyXEJsvfnz043oSgjPnQbihmtvlqIKO4M3kp3uKaRU2XOGhID9nsS31YefVDgThBzGLstRmj7jaMVbUQKkIZ0WYWIdp9uHEYWHlq0bvyvBqULmQMXAXczOuYaKAfOZqZX+FDaBYF6+BkGVtJ233sd7NwM8kInYnbLgtjAgyS9lxcqCCR2Kax6yhwBRFtNbV1F9+w4CC7K+EDelp8KGQUEA65MLwkZaO28rjagU3ps+uiAVr+IhsBO4XUVmCBpjIO6y1SxYC
X-ClientService-ClientTag: Office 365 API Tools 1.0.33.0
X-AnchorMailbox: outlook_F26A78076F4A0070@outlook.com
Host: outlook.office.com`
http回复:
`HTTP/1.1 503 Service Unavailable
Content-Length: 0
Server: Microsoft-IIS/8.5
request-id: f1eec46a-9e69-426e-8013-a321b32b6916
X-CalculatedFETarget: namprd07-provisioning.internal.outlook.com
X-ProxyErrorLabel: ProxyHandler::OnWinHttpRequestError/WinHttpRequest::ReceiveResponse
X-ProxyErrorHResult: 0x80072efe
X-ProxyErrorMessage: The connection with the server was terminated abnormally
X-Powered-By: ASP.NET
X-FEServer: BLUPR14CA0027
X-MSEdge-Ref: Ref A: F0C2366F72364B08A9C270672FB271C1 Ref B: 1C1593F5E64AF33E0BE980EA9B1B6CDD Ref C: Thu Dec 22 00:30:31 2016 PST
Date: Thu, 22 Dec 2016 08:30:30 GMT`
更新2
经过一番调查后发现我们正在使用此代码:
var dataProvider = new MicrosoftProviderAdapter(new Uri("https://outlook.office.com/api/v2.0"), GetAccessToken);
var userDetail = await dataProvider.Me.ExecuteAsync();
dataProvider.Context.SendingRequest2 +=(sender,e)=>InsertXAnchorMailboxHeader(sender, e, userDetail.EmailAddress);`
要插入X-AnchorMailbox
,但出于某种原因,如果使用sheta.fadi@outlook.com登录,请回复
await dataProvider.Me.ExecuteAsync()
已将outlook_F26A78076F4A0070@outlook.com作为电子邮件而非sheta.fadi@outlook.com
附:这个电话一直持续到上周