4.2 Synchronizing Tasks on the Client
The following example demonstrates a client’s request to synchronize its task data with the server, and the server’s response. In this example, the client does not submit any changes in the Sync command request ([MS-ASCMD] section 2.2.1.21), and the server responds with a Sync command response ([MS-ASCMD] section 2.2.1.21) that includes three changes: a new task, a changed task, and a deleted task. Elements of the Task class are included in the Sync command response as child elements of the airsync:ApplicationData element ([MS-ASCMD] section 2.2.3.11) under an airsync:Add element ([MS-ASCMD] section 2.2.3.7.2), an airsync:Change element ([MS-ASCMD] section 2.2.3.24), and an airsync:Delete element ([MS-ASCMD] section 2.2.3.42.2).
Request:
-
<?xml version="1.0" encoding="utf-8"?> <Sync xmlns="AirSync:"> <Collections> <Collection> <SyncKey>761975125</SyncKey> <CollectionId>19</CollectionId> <DeletesAsMoves>1</DeletesAsMoves> <GetChanges>1</GetChanges> <WindowSize>100</WindowSize> <GetChanges/> </Collection> </Collections> </Sync>
Response:
-
<?xml version="1.0" encoding="utf-8"?> <Sync xmlns="AirSync:" xmlns:airsyncbase="AirSyncBase:" xmlns:tasks="Tasks:"> <Collections> <Collection> <SyncKey>457669362</SyncKey> <CollectionId>19</CollectionId> <Status>1</Status> <Commands> <Change> <ServerId>19:1</ServerId> <ApplicationData> <airsyncbase:Body> <airsyncbase:Type>3</airsyncbase:Type> <airsyncbase:EstimatedDataSize>5731</airsyncbase:EstimatedDataSize> <airsyncbase:Truncated>1</airsyncbase:Truncated> </airsyncbase:Body> <tasks:Subject>Finish Q4 sales roll-up</tasks:Subject> <tasks:Importance>1</tasks:Importance> <tasks:UtcStartDate>2008-10-02T07:00:00.000Z</tasks:UtcStartDate> <tasks:StartDate>2008-10-02T00:00:00.000Z</tasks:StartDate> <tasks:UtcDueDate>2008-10-10T07:00:00.000Z</tasks:UtcDueDate> <tasks:DueDate>2008-10-10T00:00:00.000Z</tasks:DueDate> <tasks:Complete>0</tasks:Complete> <tasks:Sensitivity>0</tasks:Sensitivity> <tasks:ReminderTime>2008-10-10T19:30:00.000Z</tasks:ReminderTime> <tasks:ReminderSet>1</tasks:ReminderSet> </ApplicationData> </Change> <Add> <ServerId>19:3</ServerId> <ApplicationData> <airsyncbase:Body> <airsyncbase:Type>1</airsyncbase:Type> <airsyncbase:EstimatedDataSize>0</airsyncbase:EstimatedDataSize> <airsyncbase:Truncated>1</airsyncbase:Truncated> </airsyncbase:Body> <tasks:Subject>Email management team about next round of quarterlies</tasks:Subject> <tasks:Importance>1</tasks:Importance> <tasks:UtcStartDate>2008-10-02T07:00:00.000Z</tasks:UtcStartDate> <tasks:StartDate>2008-10-02T00:00:00.000Z</tasks:StartDate> <tasks:UtcDueDate>2008-10-02T07:00:00.000Z</tasks:UtcDueDate> <tasks:DueDate>2008-10-02T00:00:00.000Z</tasks:DueDate> <tasks:Complete>0</tasks:Complete> <tasks:Sensitivity>0</tasks:Sensitivity> <tasks:ReminderSet>0</tasks:ReminderSet> </ApplicationData> </Add> <Delete> <ServerId>19:2</ServerId> </Delete> </Commands> </Collection> </Collections> </Sync>