mirror of
https://github.com/moparisthebest/davmail
synced 2024-12-13 19:22:22 -05:00
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
This commit is contained in:
parent
ac16857c08
commit
cd2ae6c5f2
@ -904,14 +904,17 @@ public class EwsExchangeSession extends ExchangeSession {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (currentItemId != null) {
|
if (currentItemId != null) {
|
||||||
Set<FieldUpdate> updates = new HashSet<FieldUpdate>();
|
/*Set<FieldUpdate> updates = new HashSet<FieldUpdate>();
|
||||||
updates.add(new FieldUpdate(Field.get("mimeContent"), String.valueOf(Base64.encodeBase64(itemContent))));
|
updates.add(new FieldUpdate(Field.get("mimeContent"), new String(Base64.encodeBase64(itemContent))));
|
||||||
// update
|
// update
|
||||||
createOrUpdateItemMethod = new UpdateItemMethod(MessageDisposition.SaveOnly,
|
createOrUpdateItemMethod = new UpdateItemMethod(MessageDisposition.SaveOnly,
|
||||||
ConflictResolution.AlwaysOverwrite,
|
ConflictResolution.AutoResolve,
|
||||||
SendMeetingInvitationsOrCancellations.SendToNone,
|
SendMeetingInvitationsOrCancellations.SendToNone,
|
||||||
currentItemId, updates);
|
currentItemId, updates);*/
|
||||||
} else {
|
// hard method: delete/create on update
|
||||||
|
DeleteItemMethod deleteItemMethod = new DeleteItemMethod(currentItemId, DeleteType.HardDelete, SendMeetingCancellations.SendToNone);
|
||||||
|
executeMethod(deleteItemMethod);
|
||||||
|
} //else {
|
||||||
// create
|
// create
|
||||||
EWSMethod.Item newItem = new EWSMethod.Item();
|
EWSMethod.Item newItem = new EWSMethod.Item();
|
||||||
newItem.type = "CalendarItem";
|
newItem.type = "CalendarItem";
|
||||||
@ -922,14 +925,14 @@ public class EwsExchangeSession extends ExchangeSession {
|
|||||||
//updates.add(Field.createFieldUpdate("outlookmessageclass", "IPM.Appointment"));
|
//updates.add(Field.createFieldUpdate("outlookmessageclass", "IPM.Appointment"));
|
||||||
newItem.setFieldUpdates(updates);
|
newItem.setFieldUpdates(updates);
|
||||||
createOrUpdateItemMethod = new CreateItemMethod(MessageDisposition.SaveOnly, SendMeetingInvitations.SendToNone, getFolderId(folderPath), newItem);
|
createOrUpdateItemMethod = new CreateItemMethod(MessageDisposition.SaveOnly, SendMeetingInvitations.SendToNone, getFolderId(folderPath), newItem);
|
||||||
}
|
//}
|
||||||
|
|
||||||
executeMethod(createOrUpdateItemMethod);
|
executeMethod(createOrUpdateItemMethod);
|
||||||
|
|
||||||
itemResult.status = createOrUpdateItemMethod.getStatusCode();
|
itemResult.status = createOrUpdateItemMethod.getStatusCode();
|
||||||
if (itemResult.status == HttpURLConnection.HTTP_OK) {
|
if (itemResult.status == HttpURLConnection.HTTP_OK) {
|
||||||
//noinspection VariableNotUsedInsideIf
|
//noinspection VariableNotUsedInsideIf
|
||||||
if (etag == null) {
|
if (currentItemId == null) {
|
||||||
itemResult.status = HttpStatus.SC_CREATED;
|
itemResult.status = HttpStatus.SC_CREATED;
|
||||||
LOGGER.debug("Updated event " + getHref());
|
LOGGER.debug("Updated event " + getHref());
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user