EWS: fix contact email update

git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@1537 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
mguessan 2010-11-09 11:47:34 +00:00
parent 52fbe3119f
commit 12e047b6e2
2 changed files with 18 additions and 4 deletions

View File

@ -120,9 +120,9 @@ public class Field {
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("smtpemail1", new IndexedFieldURI("contacts:EmailAddress", "EmailAddress1", "Contact", "EmailAddresses"));
FIELD_MAP.put("smtpemail2", new IndexedFieldURI("contacts:EmailAddress", "EmailAddress2", "Contact", "EmailAddresses"));
FIELD_MAP.put("smtpemail3", new IndexedFieldURI("contacts:EmailAddress", "EmailAddress3", "Contact", "EmailAddresses"));
FIELD_MAP.put("facsimiletelephonenumber", new ExtendedFieldURI(0x3A24, ExtendedFieldURI.PropertyType.String));
FIELD_MAP.put("givenName", new ExtendedFieldURI(0x3A06, ExtendedFieldURI.PropertyType.String));

View File

@ -26,6 +26,8 @@ import davmail.util.StringUtil;
public class IndexedFieldURI implements FieldURI {
protected final String fieldURI;
protected final String fieldIndex;
protected final String fieldItemType;
protected final String collectionName;
/**
* Create indexed field uri.
@ -33,9 +35,11 @@ public class IndexedFieldURI implements FieldURI {
* @param fieldURI base field uri
* @param fieldIndex field name
*/
public IndexedFieldURI(String fieldURI, String fieldIndex) {
public IndexedFieldURI(String fieldURI, String fieldIndex, String fieldItemType, String collectionName) {
this.fieldURI = fieldURI;
this.fieldIndex = fieldIndex;
this.fieldItemType = fieldItemType;
this.collectionName = collectionName;
}
public void appendTo(StringBuilder buffer) {
@ -45,9 +49,19 @@ public class IndexedFieldURI implements FieldURI {
}
public void appendValue(StringBuilder buffer, String itemType, String value) {
if (itemType != null) {
// append IndexedFieldURI
appendTo(buffer);
buffer.append("<t:").append(fieldItemType).append('>');
buffer.append("<t:").append(collectionName).append('>');
}
buffer.append("<t:Entry Key=\"").append(fieldIndex).append("\">");
buffer.append(StringUtil.xmlEncode(value));
buffer.append("</t:Entry>");
if (itemType != null) {
buffer.append("</t:").append(collectionName).append('>');
buffer.append("</t:").append(fieldItemType).append('>');
}
}
public String getResponseName() {