OutlookServicesClient throws a DataServiceQueryException

468 views Asked by At

When trying to execute a request using Microsoft.Office365.OutlookServices OutlookServicesClent with query, returns with Microsoft.OData.Client.DataServiceQueryException Stack trace: 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

and the error is: 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}


Update

http request:

`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: [email protected]
Host: outlook.office.com`

http response:

`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`

Update 2

After some investigation, turns out that we are using this code:

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);`

to insert X-AnchorMailbox but for some reason if logged in with [email protected] the response of await dataProvider.Me.ExecuteAsync() has [email protected] as email and not [email protected] p.s. this call worked up until last week

0

There are 0 answers