From 47e90d9bec1243f67b67bcb4add59287bebf712a Mon Sep 17 00:00:00 2001 From: mguessan Date: Fri, 26 Nov 2010 10:24:00 +0000 Subject: [PATCH] Do not send Exchange 2003 appointment creation request to Exchange 2007 git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@1561 3d1905a2-6b24-0410-a738-b14d5a86fcbd --- .../exchange/dav/DavExchangeSession.java | 22 ++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/src/java/davmail/exchange/dav/DavExchangeSession.java b/src/java/davmail/exchange/dav/DavExchangeSession.java index 82dbcfe8..090345ec 100644 --- a/src/java/davmail/exchange/dav/DavExchangeSession.java +++ b/src/java/davmail/exchange/dav/DavExchangeSession.java @@ -2086,18 +2086,20 @@ public class DavExchangeSession extends ExchangeSession { String folderPath = getFolderPath("davmailtemp"); createCalendarFolder(folderPath, null); - PostMethod postMethod = new PostMethod(URIUtil.encodePath(folderPath)); - postMethod.addParameter("Cmd", "saveappt"); - postMethod.addParameter("FORMTYPE", "appointment"); String fakeEventUrl = null; - try { - // create fake event - int statusCode = httpClient.executeMethod(postMethod); - if (statusCode == HttpStatus.SC_OK) { - fakeEventUrl = StringUtil.getToken(postMethod.getResponseBodyAsString(), "", ""); + if ("Exchange2003".equals(serverVersion)) { + PostMethod postMethod = new PostMethod(URIUtil.encodePath(folderPath)); + postMethod.addParameter("Cmd", "saveappt"); + postMethod.addParameter("FORMTYPE", "appointment"); + try { + // create fake event + int statusCode = httpClient.executeMethod(postMethod); + if (statusCode == HttpStatus.SC_OK) { + fakeEventUrl = StringUtil.getToken(postMethod.getResponseBodyAsString(), "", ""); + } + } finally { + postMethod.releaseConnection(); } - } finally { - postMethod.releaseConnection(); } // failover for Exchange 2007, use PROPPATCH with forced timezone if (fakeEventUrl == null) {