From 88c8cdb534716a163c28ec13e12c2877cef19e1f Mon Sep 17 00:00:00 2001 From: Jason Gunthorpe Date: Fri, 27 Mar 2020 19:50:09 -0300 Subject: o365: Support delete_action in O365 If set to "delete" the deleted messages will go to Deleted Items by default things go to Archive, just like gmail. Signed-off-by: Jason Gunthorpe --- cloud_mdir_sync/office365.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/cloud_mdir_sync/office365.py b/cloud_mdir_sync/office365.py index 5c52228..3f9ddc7 100644 --- a/cloud_mdir_sync/office365.py +++ b/cloud_mdir_sync/office365.py @@ -364,6 +364,7 @@ class O365Mailbox(mailbox.Mailbox): timer = None use_owa_subscribe = True graph: GraphAPI + delete_action = "archive" # or delete def __init__(self, cfg: config.Config, @@ -651,7 +652,11 @@ class O365Mailbox(mailbox.Mailbox): self.graph.post_json( "v1.0", f"/me/mailFolders/{self.mailbox}/messages/{cmsg.storage_id}/move", - body={"destinationId": "deleteditems"})) + body={ + "destinationId": + "deleteditems" + if self.delete_action == "delete" else "archive" + })) del self.messages[ch] await asyncio_complete(*todo_flags) -- cgit v1.2.3