mirror of
https://github.com/moparisthebest/davmail
synced 2025-02-28 17:31:52 -05:00
Carddav: disable contact picture handling on Exchange 2007
git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@1314 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
parent
5ea415bf49
commit
04bf3294bc
@ -776,23 +776,26 @@ public class EwsExchangeSession extends ExchangeSession {
|
||||
|
||||
ItemId newItemId = new ItemId(createOrUpdateItemMethod.getResponseItem());
|
||||
|
||||
// first delete current picture
|
||||
if (currentFileAttachment != null) {
|
||||
DeleteAttachmentMethod deleteAttachmentMethod = new DeleteAttachmentMethod(currentFileAttachment.attachmentId);
|
||||
executeMethod(deleteAttachmentMethod);
|
||||
}
|
||||
|
||||
if (photo != null) {
|
||||
// convert image to jpeg
|
||||
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);
|
||||
// disable contact picture handling on Exchange 2007
|
||||
if (!"Exchange2010".equals(serverVersion)) {
|
||||
// first delete current picture
|
||||
if (currentFileAttachment != null) {
|
||||
DeleteAttachmentMethod deleteAttachmentMethod = new DeleteAttachmentMethod(currentFileAttachment.attachmentId);
|
||||
executeMethod(deleteAttachmentMethod);
|
||||
}
|
||||
|
||||
if (photo != null) {
|
||||
// convert image to jpeg
|
||||
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);
|
||||
}
|
||||
// update photo attachment
|
||||
CreateAttachmentMethod createAttachmentMethod = new CreateAttachmentMethod(newItemId, attachment);
|
||||
executeMethod(createAttachmentMethod);
|
||||
}
|
||||
// update photo attachment
|
||||
CreateAttachmentMethod createAttachmentMethod = new CreateAttachmentMethod(newItemId, attachment);
|
||||
executeMethod(createAttachmentMethod);
|
||||
}
|
||||
|
||||
GetItemMethod getItemMethod = new GetItemMethod(BaseShape.ID_ONLY, newItemId, false);
|
||||
@ -1122,7 +1125,7 @@ public class EwsExchangeSession extends ExchangeSession {
|
||||
String subFolderPath;
|
||||
if (slashIndex >= 0) {
|
||||
mailbox = folderPath.substring(USERS_ROOT.length(), slashIndex);
|
||||
subFolderPath = folderPath.substring(slashIndex+1);
|
||||
subFolderPath = folderPath.substring(slashIndex + 1);
|
||||
} else {
|
||||
mailbox = folderPath.substring(USERS_ROOT.length());
|
||||
subFolderPath = "";
|
||||
|
Loading…
x
Reference in New Issue
Block a user