diff --git a/src/java/davmail/exchange/ExchangeSession.java b/src/java/davmail/exchange/ExchangeSession.java index 33616eea..83ec34ce 100644 --- a/src/java/davmail/exchange/ExchangeSession.java +++ b/src/java/davmail/exchange/ExchangeSession.java @@ -1017,7 +1017,7 @@ public abstract class ExchangeSession { } } - public void convertResentHeader(MimeMessage mimeMessage, String headerName) throws MessagingException { + protected void convertResentHeader(MimeMessage mimeMessage, String headerName) throws MessagingException { String[] resentHeader = mimeMessage.getHeader("Resent-"+headerName); if (resentHeader != null) { mimeMessage.removeHeader("Resent-"+headerName); diff --git a/src/java/davmail/exchange/ews/EwsExchangeSession.java b/src/java/davmail/exchange/ews/EwsExchangeSession.java index 53395af8..dd610fbf 100644 --- a/src/java/davmail/exchange/ews/EwsExchangeSession.java +++ b/src/java/davmail/exchange/ews/EwsExchangeSession.java @@ -733,7 +733,7 @@ public class EwsExchangeSession extends ExchangeSession { for (Map.Entry entry : entrySet()) { if ("photo".equals(entry.getKey())) { list.add(Field.createFieldUpdate("haspicture", "true")); - } else { + } else if (!entry.getKey().startsWith("email")){ list.add(Field.createFieldUpdate(entry.getKey(), entry.getValue())); } } diff --git a/src/java/davmail/exchange/ews/Field.java b/src/java/davmail/exchange/ews/Field.java index 51dbdb7e..c0919e8e 100644 --- a/src/java/davmail/exchange/ews/Field.java +++ b/src/java/davmail/exchange/ews/Field.java @@ -101,16 +101,23 @@ public class Field { FIELD_MAP.put("co", new ExtendedFieldURI(ExtendedFieldURI.DistinguishedPropertySetType.Address, 0x8049, ExtendedFieldURI.PropertyType.String)); FIELD_MAP.put("department", new ExtendedFieldURI(0x3A18, ExtendedFieldURI.PropertyType.String)); + /* FIELD_MAP.put("email1", new ExtendedFieldURI(ExtendedFieldURI.DistinguishedPropertySetType.Address, 0x8083, ExtendedFieldURI.PropertyType.String)); // Email1EmailAddress FIELD_MAP.put("email2", new ExtendedFieldURI(ExtendedFieldURI.DistinguishedPropertySetType.Address, 0x8093, ExtendedFieldURI.PropertyType.String)); // Email2EmailAddress FIELD_MAP.put("email3", new ExtendedFieldURI(ExtendedFieldURI.DistinguishedPropertySetType.Address, 0x80A3, ExtendedFieldURI.PropertyType.String)); // Email3EmailAddress - FIELD_MAP.put("smtpemail1", new ExtendedFieldURI(ExtendedFieldURI.DistinguishedPropertySetType.Address, 0x8084, ExtendedFieldURI.PropertyType.String)); // Email1OriginalDisplayName FIELD_MAP.put("smtpemail2", new ExtendedFieldURI(ExtendedFieldURI.DistinguishedPropertySetType.Address, 0x8094, ExtendedFieldURI.PropertyType.String)); // Email2OriginalDisplayName FIELD_MAP.put("smtpemail3", new ExtendedFieldURI(ExtendedFieldURI.DistinguishedPropertySetType.Address, 0x80A4, ExtendedFieldURI.PropertyType.String)); // Email3OriginalDisplayName - + FIELD_MAP.put("displayemail1", new ExtendedFieldURI(ExtendedFieldURI.DistinguishedPropertySetType.Address, 0x8080, ExtendedFieldURI.PropertyType.String)); // Email1DisplayName + FIELD_MAP.put("displayemail2", new ExtendedFieldURI(ExtendedFieldURI.DistinguishedPropertySetType.Address, 0x8090, ExtendedFieldURI.PropertyType.String)); // Email2DisplayName + FIELD_MAP.put("displayemail3", new ExtendedFieldURI(ExtendedFieldURI.DistinguishedPropertySetType.Address, 0x80A0, ExtendedFieldURI.PropertyType.String)); // Email3DisplayName + */ + FIELD_MAP.put("smtpemail1", new IndexedFieldURI("contacts:EmailAddress", "EmailAddress1")); + FIELD_MAP.put("smtpemail2", new IndexedFieldURI("contacts:EmailAddress", "EmailAddress2")); + FIELD_MAP.put("smtpemail3", new IndexedFieldURI("contacts:EmailAddress", "EmailAddress3")); + FIELD_MAP.put("facsimiletelephonenumber", new ExtendedFieldURI(0x3A24, ExtendedFieldURI.PropertyType.String)); FIELD_MAP.put("givenName", new ExtendedFieldURI(0x3A06, ExtendedFieldURI.PropertyType.String)); diff --git a/src/java/davmail/exchange/ews/IndexedFieldURI.java b/src/java/davmail/exchange/ews/IndexedFieldURI.java index 155d1264..fad78cff 100644 --- a/src/java/davmail/exchange/ews/IndexedFieldURI.java +++ b/src/java/davmail/exchange/ews/IndexedFieldURI.java @@ -29,8 +29,9 @@ public class IndexedFieldURI implements FieldURI { /** * Create indexed field uri. - * @param fieldURI base field uri - * @param fieldIndex field name + * + * @param fieldURI base field uri + * @param fieldIndex field name */ public IndexedFieldURI(String fieldURI, String fieldIndex) { this.fieldURI = fieldURI; @@ -46,18 +47,26 @@ public class IndexedFieldURI implements FieldURI { public void appendValue(StringBuilder buffer, String itemType, String value) { if (fieldURI.startsWith("message")) { itemType = "Message"; + } else if (fieldURI.startsWith("contacts")) { + itemType = "Contact"; } appendTo(buffer); buffer.append("'); - buffer.append("'); - buffer.append(StringUtil.xmlEncode(value)); - buffer.append("'); + if (fieldURI.endsWith("EmailAddress")) { + buffer.append(""); + buffer.append(StringUtil.xmlEncode(value)); + buffer.append(""); + } else { + buffer.append("'); + buffer.append(StringUtil.xmlEncode(value)); + buffer.append("'); + } buffer.append("');