1
0
mirror of https://github.com/moparisthebest/davmail synced 2024-12-13 03:02:22 -05:00

Caldav: Additional Allday fix for Exchange 2007 and Outlook, implement a failover with a new davmail.timezoneId setting.

git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@826 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
mguessan 2009-11-09 22:09:15 +00:00
parent 7ea972b57b
commit 2cd481ae4c

View File

@ -3148,7 +3148,7 @@ public class ExchangeSession {
String folderPath = ExchangeSession.this.getFolderPath("davmailtemp");
ExchangeSession.this.createCalendarFolder(folderPath);
PostMethod postMethod = new PostMethod(folderPath);
PostMethod postMethod = new PostMethod(URIUtil.encodePath(folderPath));
postMethod.addParameter("Cmd", "saveappt");
postMethod.addParameter("FORMTYPE", "appointment");
String fakeEventUrl = null;
@ -3161,6 +3161,28 @@ public class ExchangeSession {
} finally {
postMethod.releaseConnection();
}
// failover for Exchange 2007, use PROPPATCH with forced timezone
if (fakeEventUrl == null) {
ArrayList<DavProperty> propertyList = new ArrayList<DavProperty>();
propertyList.add(new DefaultDavProperty(DavPropertyName.create("contentclass", Namespace.getNamespace("DAV:")), "urn:content-classes:appointment"));
propertyList.add(new DefaultDavProperty(DavPropertyName.create("outlookmessageclass", Namespace.getNamespace("http://schemas.microsoft.com/exchange/")), "IPM.Appointment"));
propertyList.add(new DefaultDavProperty(DavPropertyName.create("instancetype", Namespace.getNamespace("urn:schemas:calendar:")), "0"));
// get forced timezone id from settings
timezoneId = Settings.getProperty("davmail.timezoneId");
if (timezoneId != null) {
propertyList.add(new DefaultDavProperty(DavPropertyName.create("timezoneid", Namespace.getNamespace("urn:schemas:calendar:")), timezoneId));
}
String patchMethodUrl = URIUtil.encodePath(folderPath)+ '/' + UUID.randomUUID().toString() + ".EML";
PropPatchMethod patchMethod = new PropPatchMethod(URIUtil.encodePath(patchMethodUrl), propertyList);
try {
int statusCode = httpClient.executeMethod(patchMethod);
if (statusCode == HttpStatus.SC_MULTI_STATUS) {
fakeEventUrl = patchMethodUrl;
}
} finally {
patchMethod.releaseConnection();
}
}
if (fakeEventUrl != null) {
// get fake event body
GetMethod getMethod = new GetMethod(URIUtil.encodePath(fakeEventUrl));