4.1.2 Synchronizing E-Mail Metadata and Body

The following example demonstrates a client request to synchronize both e-mail metadata and body with the server, and the server response. The Sync command request ([MS-ASCMD] section 2.2.1.21) includes the airsyncbase:BodyPreference element ([MS-ASAIRS] section 2.2.2.12) to request that the server return e-mail body in Hypertext Markup Language (HTML) format (airsyncbase:Type element ([MS-ASAIRS] section 2.2.2.41.4) value is 2) with each e-mail body truncated to 5,120 bytes (airsyncbase:TruncationSize element ([MS-ASAIRS] section 2.2.2.40.2) value is 5120). In this example, the Sync command response includes the metadata and body for one HTML e-mail message.

Note Although not shown in this example, Sync command requests can include multiple airsyncbase:BodyPreference elements to specify different airsyncbase:TruncationSize values for each airsyncbase:Type value.

Request:

 <?xml version="1.0" encoding="utf-8"?>
 <Sync xmlns:AirSyncBase="airsyncbase:" xmlns="AirSync:">
   <Collections>
     <Collection>
       <SyncKey>1534587728</SyncKey>
       <CollectionId>5</CollectionId>
       <DeletesAsMoves>1</DeletesAsMoves>
       <GetChanges>1</GetChanges>
       <WindowSize>512</WindowSize>
       <Options>
         <MIMESupport>0</MIMESupport>
         <airsyncbase:BodyPreference>
           <airsyncbase:Type>2</airsyncbase:Type>
           <airsyncbase:TruncationSize>5120</airsyncbase:TruncationSize>
         </airsyncbase:BodyPreference>
       </Options>
     </Collection>
   </Collections>
 </Sync>

Response:

 <?xml version="1.0" encoding="utf-8"?>
 <Sync xmlns:email="Email:" xmlns:email2="Email2" xmlns:airsyncbase="AirSyncBase:" xmlns="AirSync:">
   <Collections>
     <Collection>
       <SyncKey>1174511196</SyncKey>
       <CollectionId>5</CollectionId>
       <Status>1</Status>
       <Commands>
         <Add>
           <ServerId>5:10</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>Sample HTML message</email:Subject>
             <email:DateReceived>2009-02-19T01:43:25.266Z</email:DateReceived>
             <email:DisplayTo>Device User</email:DisplayTo>
             <email:ThreadTopic>Sample HTML message</email:ThreadTopic>
             <email:Importance>1</email:Importance>
             <email:Read>0</email:Read>
             <airsyncbase:Body>
               <airsyncbase:Type>2</airsyncbase:Type>
               <airsyncbase:EstimatedDataSize>375</airsyncbase:EstimatedDataSize>
               <airsyncbase:Data>&lt;html dir="ltr"&gt;
               &lt;head&gt;
               &lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8"&gt;
               &lt;style id="owaParaStyle"&gt;
               &lt;!--
               p
               {margin-top:0px;
               margin-bottom:0px}
               --&gt;
               &lt;/style&gt;
               &lt;/head&gt;
               &lt;body&gt;
               &lt;div style="font-size:13px; color:#000000; direction:ltr; font-family:Tahoma"&gt;
               &lt;div&gt;This is&amp;nbsp;the body of an&amp;nbsp;HTML e-mail message.&lt;/div&gt;
               &lt;/div&gt;
               &lt;/body&gt;
               &lt;/html&gt;
               </airsyncbase:Data>
             </airsyncbase:Body>
             <email:MessageClass>IPM.Note</email:MessageClass>
             <email:InternetCPID>28591</email:InternetCPID>
             <email:Flag />
             <email:ContentClass>urn:content-classes:message</email:ContentClass>
             <airsyncbase:NativeBodyType>2</airsyncbase:NativeBodyType>
             <email2:ConversationId>FF68022058BD485996BE15F6F6D99320</email2:ConversationId>
             <email2:ConversationIndex>CA2CFA8A23</email2:ConversationIndex>
             <email:Categories />
           </ApplicationData>
         </Add>
         <Change>
           <ServerId>5:8</ServerId>
           <ApplicationData>
             <email:Read>1</email:Read>
           </ApplicationData>
         </Change>
       </Commands>
     </Collection>
   </Collections>
 </Sync>
Show: