18.104.22.168.13 Sending a RopSetLocalReplicaMidsetDeleted ROP Request
The client MUST ensure that ranges supplied as request fields to the RopSetLocalReplicaMidsetDeleted ROP (section 22.214.171.124.4.8) are allocated by using the RopGetLocalReplicaIds ROP (section 126.96.36.199.4.7).
The value of the LongTermIdRanges field MUST only identify IDs that were assigned to an item on the client but never uploaded to the server, as well as IDs that the client will never use in the future. The value of the LongTermIdRanges field MUST NOT identify IDs that exist on the server; failure to comply with this requirement results in an inconsistent state between the client and server as the server adds the ID to the deleted items list and the item will be deleted from the client during the next synchronization while the item will still exist on the server.
The following example shows a possible implementation of the client with regards to assignment of server-allocated IDs, as specified in section 188.8.131.52.1, to objects in a local replica. Clients do not have to follow the example specified in this section; it is only used to show the applicability of the RopSetLocalReplicaMidsetDeleted ROP (section 184.108.40.206.4.8):
Initially, a client has no server-allocated IDs that it can assign to objects that are created when working offline, so it is required to ask the server to allocate a block of IDs by sending the RopGetLocalReplicaIds ROP (section 220.127.116.11.4.7). The server responds with a block of IDs that the client stores in a local replica.
The client requires the server-allocated ID whenever it has to create a message in a folder in a local replica. For that purpose, the client associates a range of IDs previously allocated with the RopGetLocalReplicaIds ROP with a folder, so that IDs from that range can be used for new or moved items in that folder.
The client creates a message in the local replica and assigns it a server-allocated ID from the set of IDs previously allocated to the folder from a call to the RopGetLocalReplicaIds ROP in step 2.
The client then deletes the message from the local replica before the message is uploaded to the server, because, for example, the client is offline.
The client issues the RopSetLocalReplicaMidsetDeleted ROP for the ID that was consumed by the client, but never passed to the server.