2

I am trying to figure out how to sync particular outlook account emails. I am using the http rest endpoints (here is a link to the documentation I have been following: https://msdn.microsoft.com/en-us/office/office365/api/mail-rest-operations#synchronize-messages).

I found out that if a user has "ported" their existing email (lets say gmail for now) to outlook, outlook assigns them a special email. Usually in the form of the following:

testaccount@gmail.com -> outlook_some hash@outlook.com

Now, I have been having some trouble syncing these "ported" users (i'll call them that for now) and every time I hit the sync api https://outlook.office.com/api/v2.0/Users/*insert email address here*/MailFolders/AllItems/messages, I get the following error:

{ error: 
   { code: 'ErrorServiceUnavailable',
 message: 'Active Directory operation did not succeed. Try again later.' } }

and the status code of the request is 503.

My request is pretty simple:

export ACCESS_TOKEN=here; export EMAIL=here; curl -X GET -H "Authorization: Bearer $ACCESS_TOKEN" \
-H "Accept: application/json" \
-H "Cache-Control: no-cache" \
-H "Postman-Token: 4455c965-0d49-610a-48e8-7ab37a20c111" \
"https://outlook.office.com/api/v2.0/Users/$EMAIL/MailFolders/AllItems/messages"

Response:

< HTTP/1.1 503 Service Unavailable
< 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: exchangecookie=**cookie**; expires=Fri, 16-Feb-2018 19:02:08 GMT; path=/; HttpOnly
< request-id: **request id**
< X-CalculatedFETarget: BN3PR0601CU001.internal.outlook.com
< X-BackEndHttpStatus: 503
< X-FEProxyInfo: BN3PR0601CA0025.NAMPRD06.PROD.OUTLOOK.COM
< X-CalculatedFETarget: namprd13-provisioning.internal.outlook.com
< X-BackEndHttpStatus: 503
< X-FEProxyInfo: DM3PR13CA0019.NAMPRD13.PROD.OUTLOOK.COM
< X-CalculatedBETarget: CY4PR13MB1078.namprd13.prod.outlook.com
< X-BackEndHttpStatus: 503
< OData-Version: 4.0
< X-AspNet-Version: 4.0.30319
< X-DiagInfo: CY4PR13MB1078
< X-BEServer: CY4PR13MB1078
< X-FEServer: DM3PR13CA0019
< X-FEServer: BN3PR0601CA0025
< X-Powered-By: ASP.NET
< X-FEServer: BY2PR11CA0016
< X-MSEdge-Ref: Ref A: 1DD7FE1BB0584157A03AB3615CBC3EB6 Ref B: BY1EDGE0414 Ref C: Thu Feb 16 11:02:08 2017 PST
< Date: Thu, 16 Feb 2017 19:02:07 GMT
< 
* Curl_http_done: called premature == 0
* Connection #0 to host outlook.office.com left intact
{"error":{"code":"ErrorServiceUnavailable","message":"Active Directory operation did not succeed. Try again later."}}

This error only happens on these "ported" outlook accounts. These users have given me access by oauth2 (i have an access token and a refresh token).

any ideas how to actually sync these accounts? Seems like a bug on outlook's side seeing as my code works great for normal outlook accounts (like jerry_smith@hotmail.com, or ilovecats@outlook.com).

thanks in advance

Jerry
  • 181
  • 1
  • 12
  • Generally an error in the 500-range does mean 'error is on the server side' so you might be better off sending a support request. – Evert Feb 16 '17 at 19:51
  • thanks for the response. where on earth do I even send a request. I tried looking around their documentation page and only ended up in some forum https://social.msdn.microsoft.com/Forums/ – Jerry Feb 16 '17 at 19:59
  • I don't work for microsoft, so I wouldn't be able to tell you. – Evert Feb 16 '17 at 20:00

1 Answers1

1

Found the answer, if you change the url to "https://outlook.office.com/api/v2.0/me/MailFolders/AllItems/messages"

(replace Users/$EMAIL with me)

it works, no 503.

Jerry
  • 181
  • 1
  • 12