开发者

Undocumented Exchange ActiveSync status while syncing

开发者 https://www.devze.com 2023-03-26 23:47 出处:网络
I\'m trying to build a simple Exchange ActiveSync client. I\'m using a simple Python script that sends an initia开发者_开发问答l sync email command, while connecting to an Exchange 2010 SP1 .

I'm trying to build a simple Exchange ActiveSync client.

I'm using a simple Python script that sends an initia开发者_开发问答l 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 value 4 represents a client protocol error. It is documented on this MSDN page.

A correct Sync command would look more like the following, assuming that Inbox has an ID of 5 (converted from WBXML to a readable XML):

<?xml version='1.0' ?>
<Sync>
  <Collections>
    <Collection>
      <SyncKey>0</SyncKey>
      <CollectionId>5</CollectionId>
      <Options>
        <FilterType>5</FilterType>
        <BodyPreference>
          <Type>1</Type>
          <TruncationSize>32768</TruncationSize>
        </BodyPreference>
      </Options>
    </Collection>
  </Collections>
</Sync>

The EAS protocol requires that you Provision and FolderSync first, however. You can't just jump straight to a Sync. The basic protocol sequence is described here.

0

精彩评论

暂无评论...
验证码 换一张
取 消