2.2.3.7.2 Add (Sync)

The Add element is an optional child element of the Commands element in Sync command requests and an optional child element of the Commands element and the Responses element in Sync command responses. It creates a new object in a collection on the client or on the server.

Elements referenced in this section are defined in the AirSync namespace, except where otherwise indicated by the presence of a namespace prefix (as defined in section 2.2.4).

Command request/response

Parent elements

Child elements

Data type

Number allowed

Sync command request (section 2.2.1.21)

Commands (section 2.2.3.32)

ClientId (section 2.2.3.28.2)

ApplicationData (section 2.2.3.11)

Class (section 2.2.3.27.6)

email2:Send ([MS-ASEMAIL] section 2.2.2.69)

container ([MS-ASDTYPE] section 2.2)

0...N (optional)

Sync command response

Commands

ServerId (section 2.2.3.166.8)

ApplicationData (section 2.2.3.11)

container

0...N (optional)

Sync command response

Responses (section 2.2.3.154)

ServerId

ClientId

Class

ApplicationData

Status (section 2.2.3.177.17)

container

0...N (optional)

When a new item is being sent from the client to the server, the ClientId element specifies a temporary ID for the item, which is unique on the client. The ApplicationData element specifies the item data. The server then responds with an Add element in a Responses element, which specifies the client ID and the server ID that was assigned to the new item.

When the client sends a Sync command request to the server and a new item has been added to the server collection since the last synchronization, the server responds with an Add element in a Commands element. This Add element specifies the server ID and data of the item to be added to the collection on the client.

One or more Add elements can appear as a child of the Commands and Responses elements for a particular collection.

The Add element cannot be used to add any non-draft email items from the client to the server, or to modify the contents of the recipient information cache. Draft email items are not supported in protocol versions 2.5, 12.0, 12.1, 14.0, and 14.1. If a client attempts to add a non-draft email to the server, a Status element with a value of 6 is returned as a child of the Add element. If a client attempts to add an item to the recipient information cache, a Status element with a value of 4 is returned as a child of the Sync element.

If the server ID in an Add element from the server matches the server ID for an item on the client, the client treats the addition as a change to the client item.

The server is not required to send an individual response for every operation that is sent by the client. The client only receives responses for successful additions, successful fetches, successful changes that include an attachment being added, and failed changes and deletions. When the client does not receive a response, the client MUST assume that the operation succeeded unless informed otherwise.

Protocol Versions

The following table specifies the protocol versions that support this element. The client indicates the protocol version being used by setting either the MS-ASProtocolVersion header, as specified in [MS-ASHTTP] section 2.2.1.1.2.6, or the Protocol version field, as specified in [MS-ASHTTP] section 2.2.1.1.1.1, in the request.

Protocol version

Element support

2.5

Yes

12.0

Yes

12.1

Yes

14.0

Yes

14.1

Yes

16.0

Yes

16.1

Yes

When protocol version 16.0 or 16.1 is used and the Add element is a child of the Responses element, the ApplicationData element is supported as a child of the Add element.