EWS: fix Exchange 2010 SP1 support

git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@1861 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
mguessan 2011-11-22 22:09:04 +00:00
parent b6d17e83a2
commit aaf5af62d1
1 changed files with 6 additions and 7 deletions

View File

@ -1193,7 +1193,7 @@ public class EwsExchangeSession extends ExchangeSession {
ItemId newItemId = new ItemId(createOrUpdateItemMethod.getResponseItem());
// disable contact picture handling on Exchange 2007
if ("Exchange2010".equals(serverVersion)) {
if (!"Exchange2007_SP1".equals(serverVersion)) {
// first delete current picture
if (currentFileAttachment != null) {
DeleteAttachmentMethod deleteAttachmentMethod = new DeleteAttachmentMethod(currentFileAttachment.attachmentId);
@ -1205,9 +1205,8 @@ public class EwsExchangeSession extends ExchangeSession {
byte[] resizedImageBytes = IOUtil.resizeImage(Base64.decodeBase64(photo.getBytes()), 90);
FileAttachment attachment = new FileAttachment("ContactPicture.jpg", "image/jpeg", new String(Base64.encodeBase64(resizedImageBytes)));
if ("Exchange2010".equals(serverVersion)) {
attachment.setIsContactPhoto(true);
}
attachment.setIsContactPhoto(true);
// update photo attachment
CreateAttachmentMethod createAttachmentMethod = new CreateAttachmentMethod(newItemId, attachment);
executeMethod(createAttachmentMethod);
@ -1398,7 +1397,7 @@ public class EwsExchangeSession extends ExchangeSession {
}
updates.add(Field.createFieldUpdate("busystatus", "BUSY".equals(vCalendar.getFirstVeventPropertyValue("X-MICROSOFT-CDO-BUSYSTATUS")) ? "Busy" : "Free"));
if (vCalendar.isCdoAllDay()) {
if ("Exchange2010".equals(serverVersion)) {
if (!"Exchange2007_SP1".equals(serverVersion)) {
updates.add(Field.createFieldUpdate("starttimezone", vCalendar.getVTimezone().getPropertyValue("TZID")));
} else {
updates.add(Field.createFieldUpdate("meetingtimezone", vCalendar.getVTimezone().getPropertyValue("TZID")));
@ -1823,7 +1822,7 @@ public class EwsExchangeSession extends ExchangeSession {
try {
String timezoneId = null;
if ("Exchange2010".equals(serverVersion)) {
if (!"Exchange2007_SP1".equals(serverVersion)) {
GetUserConfigurationMethod getUserConfigurationMethod = new GetUserConfigurationMethod();
executeMethod(getUserConfigurationMethod);
EWSMethod.Item item = getUserConfigurationMethod.getResponseItem();
@ -1846,7 +1845,7 @@ public class EwsExchangeSession extends ExchangeSession {
createCalendarFolder("davmailtemp", null);
EWSMethod.Item item = new EWSMethod.Item();
item.type = "CalendarItem";
if ("Exchange2010".equals(serverVersion)) {
if (!"Exchange2007_SP1".equals(serverVersion)) {
SimpleDateFormat dateFormatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss", Locale.ENGLISH);
dateFormatter.setTimeZone(GMT_TIMEZONE);
Calendar cal = Calendar.getInstance();