From cd2ae6c5f24384fc935db2f624fbb4123809fb26 Mon Sep 17 00:00:00 2001 From: mguessan Date: Tue, 17 Aug 2010 16:45:20 +0000 Subject: [PATCH] EWS: hard method: delete/create on update git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@1360 3d1905a2-6b24-0410-a738-b14d5a86fcbd --- .../exchange/ews/EwsExchangeSession.java | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/java/davmail/exchange/ews/EwsExchangeSession.java b/src/java/davmail/exchange/ews/EwsExchangeSession.java index 7ae10090..2dbfa5a7 100644 --- a/src/java/davmail/exchange/ews/EwsExchangeSession.java +++ b/src/java/davmail/exchange/ews/EwsExchangeSession.java @@ -904,14 +904,17 @@ public class EwsExchangeSession extends ExchangeSession { } if (currentItemId != null) { - Set updates = new HashSet(); - updates.add(new FieldUpdate(Field.get("mimeContent"), String.valueOf(Base64.encodeBase64(itemContent)))); + /*Set updates = new HashSet(); + updates.add(new FieldUpdate(Field.get("mimeContent"), new String(Base64.encodeBase64(itemContent)))); // update createOrUpdateItemMethod = new UpdateItemMethod(MessageDisposition.SaveOnly, - ConflictResolution.AlwaysOverwrite, + ConflictResolution.AutoResolve, SendMeetingInvitationsOrCancellations.SendToNone, - currentItemId, updates); - } else { + currentItemId, updates);*/ + // hard method: delete/create on update + DeleteItemMethod deleteItemMethod = new DeleteItemMethod(currentItemId, DeleteType.HardDelete, SendMeetingCancellations.SendToNone); + executeMethod(deleteItemMethod); + } //else { // create EWSMethod.Item newItem = new EWSMethod.Item(); newItem.type = "CalendarItem"; @@ -922,14 +925,14 @@ public class EwsExchangeSession extends ExchangeSession { //updates.add(Field.createFieldUpdate("outlookmessageclass", "IPM.Appointment")); newItem.setFieldUpdates(updates); createOrUpdateItemMethod = new CreateItemMethod(MessageDisposition.SaveOnly, SendMeetingInvitations.SendToNone, getFolderId(folderPath), newItem); - } + //} executeMethod(createOrUpdateItemMethod); itemResult.status = createOrUpdateItemMethod.getStatusCode(); if (itemResult.status == HttpURLConnection.HTTP_OK) { //noinspection VariableNotUsedInsideIf - if (etag == null) { + if (currentItemId == null) { itemResult.status = HttpStatus.SC_CREATED; LOGGER.debug("Updated event " + getHref()); } else {