Handling synchronization-related errors in EWS in Exchange

Find out how to handle synchronization-related errors in applications that you develop by using the EWS Managed API or EWS in Exchange.

If your application synchronizes items and folders, you might have to handle synchronization-related errors. You can handle these errors at runtime, or while you are developing your EWS application. Most of these errors are defined by the ResponseCodeType enumeration in the EWS Managed API, and the ResponseCode element in Exchange Web Services (EWS).

Table 1. Sync-related errors and how to handle them

Error Occurs when you try to… Handle it by…
ErrorInvalidSyncStateData
Synchronize items or folders by using an invalid sync state value.
Exclude a root folder in your initial SyncFolderHierarchy request, when your subsequent request does include a root folder.
Use different root folders in subsequent requests.
Ensuring that the sync state value you are sending matches the sync state value returned during a previous synchronization.
Ensuring that you are not sending the sync state for the folder hierarchy when you attempt to sync items, and vice versa.
Ensuring that you are sending the sync state for the correct root folder.
Ensuring that the same root folder is specified in each request.
Ensuring that the previous request did not specify a root folder of null, while the current request includes a root folder of root. Null and root are not treated the same.
ErrorSyncFolderNotFound
Synchronize subfolders or items in a folder that cannot be found on the server.
Ensuring that the folder ID specified in the request matches a folder ID returned from the server in a previous sync response.
ErrorTimeoutExpired
Send too many requests.
Limiting your batches to 10 items per batch to avoid getting throttled.
ServiceResponseException
Connect to EWS when the server is offline or there is a problem with connectivity.
Checking connectivity with the server and retrying your request later. This is likely a transient service error or network error.

See also