diff --git a/src/java/davmail/exchange/ExchangeSession.java b/src/java/davmail/exchange/ExchangeSession.java index c57a6262..8a8b6569 100644 --- a/src/java/davmail/exchange/ExchangeSession.java +++ b/src/java/davmail/exchange/ExchangeSession.java @@ -2247,7 +2247,9 @@ public abstract class ExchangeSession { */ public List getEventMessages(String folderPath) throws IOException { return searchEvents(folderPath, ITEM_PROPERTIES, - and(isEqualTo("outlookmessageclass", "IPM.Schedule.Meeting.Request"))); + and(or(isEqualTo("outlookmessageclass", "IPM.Schedule.Meeting.Request"), + isEqualTo("outlookmessageclass", "IPM.Schedule.Meeting.Canceled")), + or(isNull("processed"), isFalse("processed")))); } /** diff --git a/src/java/davmail/exchange/dav/DavExchangeSession.java b/src/java/davmail/exchange/dav/DavExchangeSession.java index ff16fbf9..805032b5 100644 --- a/src/java/davmail/exchange/dav/DavExchangeSession.java +++ b/src/java/davmail/exchange/dav/DavExchangeSession.java @@ -1869,14 +1869,12 @@ public class DavExchangeSession extends ExchangeSession { @Override public void processItem(String folderPath, String itemName) throws IOException { String eventPath = URIUtil.encodePath(getFolderPath(folderPath) + '/' + convertItemNameToEML(itemName)); - // mark read + // do not delete calendar messages, mark read and processed ArrayList list = new ArrayList(); - //list.add(Field.createDavProperty("processed", "true")); + list.add(Field.createDavProperty("processed", "true")); list.add(Field.createDavProperty("read", "1")); PropPatchMethod patchMethod = new PropPatchMethod(eventPath, list); DavGatewayHttpClientFacade.executeMethod(httpClient, patchMethod); - // move to trash - moveToTrash(eventPath); } @Override @@ -2297,13 +2295,9 @@ public class DavExchangeSession extends ExchangeSession { @Override protected void moveToTrash(ExchangeSession.Message message) throws IOException { - moveToTrash(message.permanentUrl); - } - - protected void moveToTrash(String messageUrl) throws IOException { String destination = URIUtil.encodePath(deleteditemsUrl) + '/' + UUID.randomUUID().toString(); - LOGGER.debug("Deleting : " + messageUrl + " to " + destination); - MoveMethod method = new MoveMethod(messageUrl, destination, false); + LOGGER.debug("Deleting : " + message.permanentUrl + " to " + destination); + MoveMethod method = new MoveMethod(message.permanentUrl, destination, false); method.addRequestHeader("Allow-rename", "t"); int status = DavGatewayHttpClientFacade.executeHttpMethod(httpClient, method);