4.24.2 Modifying a Contact with Ghosted Elements

In this scenario, the client includes the airsync:Supported element in the initial Sync command request for the default Contacts folder. This causes all of the elements not included as child elements of the airsync:Supported element that can be ghosted to be ghosted for all items in that folder, as specified in section 2.2.3.179.

First, the client sends the following initial Sync command request.

 <?xml version="1.0" encoding="utf-8"?>
 <Sync xmlns="AirSync" xmlns:contacts="Contacts">
   <Collections>
     <Collection>
       <SyncKey>0</SyncKey>
       <CollectionId>2</CollectionId>
       <Supported>
         <contacts:JobTitle/>
         <contacts:OfficeLocation/>
       </Supported>
     </Collection>
   </Collections>
 </Sync>

The server sends the following response.

 <?xml version="1.0" encoding="utf-8"?>
 <Sync xmlns="AirSync">
   <Collections>
     <Collection>
       <SyncKey>719108528</SyncKey>
       <CollectionId>2</CollectionId>
       <Status>1</Status>
     </Collection>
   </Collections>
 </Sync>

Since the client included the contacts:JobTitle element ([MS-ASCNTC] section 2.2.2.44) and the contacts:OfficeLocation element ([MS-ASCNTC] section 2.2.2.51) as child elements of the airsync:Supported element, those elements are not ghosted. All other elements in the Contacts namespace are ghosted.

The client then synchronizes the contents of the default Contacts folder by using the following Sync command request.

 <?xml version="1.0" encoding="utf-8"?>
 <Sync xmlns="AirSync">
   <Collections>
     <Collection>
       <SyncKey>719108528</SyncKey>
       <CollectionId>2</CollectionId>
     </Collection>
   </Collections>
 </Sync>

The server sends the following response.

 <?xml version="1.0" encoding="utf-8"?>
 <Sync xmlns="AirSync" xmlns:airsyncbase="AirSyncBase" xmlns:contacts="Contacts">
   <Collections>
     <Collection>
       <SyncKey>846142473</SyncKey>
       <CollectionId>2</CollectionId>
       <Status>1</Status>
       <Commands>
         <Add>
           <ServerId>2:1</ServerId>
           <ApplicationData>
             <airsyncbase:Body>
               <airsyncbase:Type>1</airsyncbase:Type>
               <airsyncbase:EstimatedDataSize>0</airsyncbase:EstimatedDataSize>
               <airsyncbase:Truncated>1</airsyncbase:Truncated>
             </airsyncbase:Body>
             <contacts:Department>Accounting</contacts:Department>
             <contacts:Email1Address>"elvin@contoso.com" 
                 &lt;elvin@contoso.com&gt;</contacts:Email1Address>
             <contacts:FileAs>Sills, Elvin</contacts:FileAs>
             <contacts:FirstName>Elvin</contacts:FirstName>
             <contacts:CompanyName>Contoso, Inc.</contacts:CompanyName>
             <contacts:LastName>Sills</contacts:LastName>
             <contacts:JobTitle>Assistant Manager</contacts:JobTitle>
             <contacts:OfficeLocation>123</contacts:OfficeLocation>
             <airsyncbase:NativeBodyType>1</airsyncbase:NativeBodyType>
           </ApplicationData>
         </Add>
       </Commands>
     </Collection>
   </Collections>
 </Sync>

The client modifies the contact (2) using the airsync:Change element (section 2.2.3.24) in a Sync command request. The client updates the values of the contacts:JobTitle and contacts:OfficeLocation elements and does not include the contacts:CompanyName element ([MS-ASCNTC] section 2.2.2.24). The client sends the following Sync command request.

 <?xml version="1.0" encoding="utf-8"?>
 <Sync xmlns="AirSync" xmlns:airsyncbase="AirSyncBase" xmlns:contacts="Contacts">
   <Collections>
     <Collection>
       <SyncKey>846142473</SyncKey>
       <CollectionId>2</CollectionId>
       <Commands>
         <Change>
           <ServerId>2:1</ServerId>
           <ApplicationData>
             <contacts:Department>Accounting</contacts:Department>
             <contacts:Email1Address>"elvin@contoso.com" 
                 &lt;elvin@contoso.com&gt;</contacts:Email1Address>
             <contacts:FileAs>Sills, Elvin</contacts:FileAs>
             <contacts:FirstName>Elvin</contacts:FirstName>
             <contacts:LastName>Sills</contacts:LastName>
             <contacts:JobTitle>Manager</contacts:JobTitle>
             <contacts:OfficeLocation>456</contacts:OfficeLocation>
           </ApplicationData>
         </Change>
       </Commands>
     </Collection>
   </Collections>
 </Sync>

The server sends the following response.

 <?xml version="1.0" encoding="utf-8"?>
 <Sync xmlns="AirSync">
   <Collections>
     <Collection>
       <SyncKey>195024309</SyncKey>
       <CollectionId>2</CollectionId>
       <Status>1</Status>
     </Collection>
   </Collections>
 </Sync>

On the server, the contact (2) now has the following field values.

Contact field

Old value

New value

First name

Elvin

Elvin

Last name

Sills

Sills

Company name

Contoso, Inc.

Contoso, Inc.

Job title

Assistant Manager

Manager

Department

Accounting

Accounting

Office location

123

456

Email address

elvin@contoso.com

elvin@contoso.com

Since the contacts:CompanyName element was ghosted and the element was not included within the airsync:Change element, the value for this element was preserved.