问题
When a message is deleted, my application will send a Sync request with a Delete command within the Commands element. The application also sets the DeletesAsMoves option so that the message is not deleted permanently, but instead moved to the Deleted Items folder. This all works great. However, my challenge is to now move the message back out of the Deleted Items folder. This is failing because once the message is deleted in the Sync command, its message id changes.
In the MoveItems request, the new message id comes back in the response. Is there a similar way for me to track the changed message id after a Sync/Delete command?
Below is the request:
<?xml version="1.0"?>
<Sync>
<Collections>
<Collection>
<Class>Email</Class>
<SyncKey>{F8654B17-4BF2-439F-9875-22EDDE1138FF}154</SyncKey>
<CollectionId>03cd385d379ece4988b9c88834382ea7-68cc1f</CollectionId>
<DeletesAsMoves/>
<GetChanges/>
<WindowSize>50</WindowSize>
<Options>
<FilterType>2</FilterType>
<Truncation>7</Truncation>
</Options>
<Commands>
<Delete>
<ServerId>3:225</ServerId>
</Delete>
</Commands>
</Collection>
</Collections>
</Sync>
And the response:
<?xml version="1.0"?>
<Sync>
<Collections>
<Collection>
<Class>Email</Class>
<SyncKey>{F8654B17-4BF2-439F-9875-22EDDE1138FF}155</SyncKey>
<CollectionId>03cd385d379ece4988b9c88834382ea7-68cc1f</CollectionId>
<Status>1</Status>
</Collection>
</Collections>
</Sync>
The response indicates that the delete command was successful, however the message is now in another folder with an entirely new ServerId. I would like to be able to know what that new ServerId is.
来源:https://stackoverflow.com/questions/7716926/how-to-get-the-new-message-id-after-a-sync-delete-request