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:
parent
5fca57f0f3
commit
77f05c88f3
@ -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);
|
||||
|
@ -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()));
|
||||
}
|
||||
}
|
||||
|
@ -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));
|
||||
|
||||
|
@ -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("<t:");
|
||||
buffer.append(itemType);
|
||||
buffer.append('>');
|
||||
buffer.append("<t:");
|
||||
buffer.append(fieldIndex);
|
||||
buffer.append('>');
|
||||
buffer.append(StringUtil.xmlEncode(value));
|
||||
buffer.append("</t:");
|
||||
buffer.append(fieldIndex);
|
||||
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('>');
|
||||
buffer.append(StringUtil.xmlEncode(value));
|
||||
buffer.append("</t:");
|
||||
buffer.append(fieldIndex);
|
||||
buffer.append('>');
|
||||
}
|
||||
buffer.append("</t:");
|
||||
buffer.append(itemType);
|
||||
buffer.append('>');
|
||||
|
Loading…
Reference in New Issue
Block a user