otris/ews-cpp

move_to_deleted_items

Izulle opened this issue · 2 comments

I am using service::delete_item() to move letters into trash folder. It works fine but I just read
https://docs.microsoft.com/en-us/exchange/client-developer/web-service-reference/deleteitem-operation

An error response that includes the ErrorCannotDeleteObject error code will be returned for a DeleteItem operation when a delegate tries to delete an item in the principal's mailbox by setting the DisposalType to MoveToDeletedItems. To delete an item by moving it to the Deleted Items folder, a delegate must use the MoveItem operation.

And I am confused now. Should i change it to move_item() ?

Only if you delete items in the context of Delegation (when you have one person who has been granted delegate access to be able to remove an item in another person's mailbox).

So in general you should be fine with DeleteItem operation. But if Delegation is a topic for you in your context, you might want to play around a little with deleting items and catch that error response.

Thanks