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

Carddav: Fix email update over EWS

git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@1365 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
mguessan 2010-08-18 16:56:25 +00:00
parent 5fca57f0f3
commit 77f05c88f3
4 changed files with 29 additions and 13 deletions

View File

@ -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);

View File

@ -733,7 +733,7 @@ public class EwsExchangeSession extends ExchangeSession {
for (Map.Entry<String, String> 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()));
}
}

View File

@ -101,15 +101,22 @@ 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));

View File

@ -29,6 +29,7 @@ public class IndexedFieldURI implements FieldURI {
/**
* Create indexed field uri.
*
* @param fieldURI base field uri
* @param fieldIndex field name
*/
@ -46,11 +47,18 @@ 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("<t:");
buffer.append(itemType);
buffer.append('>');
if (fieldURI.endsWith("EmailAddress")) {
buffer.append("<t:EmailAddresses><t:Entry Key=\"").append(fieldIndex).append("\">");
buffer.append(StringUtil.xmlEncode(value));
buffer.append("</t:Entry></t:EmailAddresses>");
} else {
buffer.append("<t:");
buffer.append(fieldIndex);
buffer.append('>');
@ -58,6 +66,7 @@ public class IndexedFieldURI implements FieldURI {
buffer.append("</t:");
buffer.append(fieldIndex);
buffer.append('>');
}
buffer.append("</t:");
buffer.append(itemType);
buffer.append('>');