使用主动同步协议下载附件

Download attachment using active sync protocol

我可以使用 Sync 命令从服务器获取邮件正文和附件详细信息。现在我找不到下载附件并在屏幕上显示的方法。下面是我的 sync 命令响应。

<?xml version="1.0" encoding="utf-8"?>
<Sync xmlns:email="Email:" xmlns:airsyncbase="AirSyncBase:" xmlns:email2="Email2:" xmlns="AirSync:">
  <Collections>
    <Collection>
      <SyncKey>334239291</SyncKey> <CollectionId>5</CollectionId> <Status>1</Status>
       <Commands>
         <Add>
           <ServerId>5:3</ServerId>
           <ApplicationData>
             <email:To>"Device User" &lt;someone1@example.com&gt;</email:To> 
             <email:From>"Device User2" &lt;someone2@example.com&gt;</email:From>              
             <email:Subject>With Attachment</email:Subject> 
             <email:DateReceived>2009-03-04T22:48:41.211Z</email:DateReceived> 
             <email:DisplayTo>Device User</email:DisplayTo>               
             <email:ThreadTopic>With Attachment</email:ThreadTopic> 
             <email:Importance>1</email:Importance>
             <email:Read>0</email:Read> 
             <airsyncbase:Attachments>
               <airsyncbase:Attachment>               
                 <airsyncbase:DisplayName>Test.txt</airsyncbase:DisplayName>      
                 <airsyncbase:FileReference>5%3a3%3a0</airsyncbase:FileReference> 
                 <airsyncbase:Method>1</airsyncbase:Method> 
                 <airsyncbase:EstimatedDataSize>84</airsyncbase:EstimatedDataSize>
               </airsyncbase:Attachment> </airsyncbase:Attachments> 
             <airsyncbase:Body>
               <airsyncbase:Type>1</airsyncbase:Type>                        
               <airsyncbase:EstimatedDataSize>33</airsyncbase:EstimatedDataSize> 
               <airsyncbase:Truncated>1</airsyncbase:Truncated>
             </airsyncbase:Body> 
             <email:Flag /> 
             <email:ContentClass>urn:content-classes:message</email:ContentClass> <airsyncbase:NativeBodyType>1</airsyncbase:NativeBodyType> <email2:ConversationId>¥gÈtent-cl<email2:ConversationId> <email2:ConversationIndex>...<email2:ConversationIndex> <email:Categories />
          </ApplicationData>
        </Add>
      </Commands>
    </Collection>
  </Collections>
</Sync>



您应该下载一份 [MS-ASCMD]. It can answer a lot of your questions about ActiveSync. For attachments, it depends on the version of the protocol you are using. For 12.1 and earlier, you need to use the GetAttachment command. For 14.0 and up, you need to use the ItemOperations command. Here's an example