I'm trying to build a simple Exchange ActiveSync client.
I'm using a simple Python script that sends an initial sync email command, while connecting to an Exchange 2010 SP1 .
In the request body I'm send the following XML encoded as WBXML (using pywbxml):
<?xml version="1.0"?>
<!DOCTYPE AirSync PUBLIC "-//AIRSYNC//DTD AirSync//EN" "http://www.microsoft.com/">
<Sync>
<Collections>
<Collection>
<Class>Email</Class>
<SyncKey>0</SyncKey>
<CollectionId>5</CollectionId>
</Collection>
</Collections>
</Sync>
The server answers with a 200 OK
but returns a Status code: 4
<?xml version="1.0"?>
<!DOCTYPE AirSync PUBLIC "-//AIRSYNC//DTD AirSync//EN" "http://www.microsoft.com/">
<Sync>
<Status>4</Status>
</Sync>
I couldn't find any documentation on this status code in the official docs. How can I figure this out?
The
Sync
status code value4
represents a client protocol error. It is documented on this MSDN page.A correct
Sync
command would look more like the following, assuming thatInbox
has an ID of 5 (converted from WBXML to a readable XML):The EAS protocol requires that you
Provision
andFolderSync
first, however. You can't just jump straight to aSync
. The basic protocol sequence is described here.