EWS: more caldav ews fixes

git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@1454 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
mguessan 2010-09-16 09:27:06 +00:00
parent 48856c9bd7
commit 82eb331997
3 changed files with 18 additions and 5 deletions

View File

@ -450,6 +450,10 @@ public class VCalendar extends VObject {
return getFirstVeventProperty("ATTENDEE") != null;
}
public void setFirstVeventPropertyValue(String propertyName, String propertyValue) {
firstVevent.setPropertyValue(propertyName, propertyValue);
}
/**
* VCalendar recipients for notifications

View File

@ -376,6 +376,7 @@ public class EwsExchangeSession extends ExchangeSession {
protected byte[] getContent(ItemId itemId) throws IOException {
GetItemMethod getItemMethod = new GetItemMethod(BaseShape.ID_ONLY, itemId, true);
getItemMethod.addAdditionalProperty(Field.get("reminderset"));
getItemMethod.addAdditionalProperty(Field.get("calendaruid"));
executeMethod(getItemMethod);
byte[] mimeContent = getItemMethod.getMimeContent();
VCalendar vCalendar = new VCalendar(mimeContent, email, getVTimezone());
@ -383,6 +384,10 @@ public class EwsExchangeSession extends ExchangeSession {
if (!"true".equals(getItemMethod.getResponseItem().get(Field.get("reminderset").getResponseName()))) {
vCalendar.removeVAlarm();
}
String calendaruid = getItemMethod.getResponseItem().get(Field.get("calendaruid").getResponseName());
if (calendaruid != null) {
vCalendar.setFirstVeventPropertyValue("UID", calendaruid);
}
return vCalendar.toString().getBytes("UTF-8");
}
@ -1101,13 +1106,15 @@ public class EwsExchangeSession extends ExchangeSession {
if (!vCalendar.hasVAlarm()) {
updates.add(Field.createFieldUpdate("reminderset", "false"));
}
//updates.add(Field.createFieldUpdate("outlookmessageclass", "IPM.Appointment"));
// force urlcompname
updates.add(Field.createFieldUpdate("urlcompname", convertItemNameToEML(itemName)));
// does not work
/*if (!vCalendar.isMeeting()) {
updates.add(Field.createFieldUpdate("ismeeting", "false"));
}*/
//updates.add(Field.createFieldUpdate("outlookmessageclass", "IPM.Appointment"));
if (vCalendar.isMeeting()) {
updates.add(Field.createFieldUpdate("apptstateflags", "1"));
} else {
updates.add(Field.createFieldUpdate("apptstateflags", "0"));
}
newItem.setFieldUpdates(updates);
createOrUpdateItemMethod = new CreateItemMethod(MessageDisposition.SaveOnly, SendMeetingInvitations.SendToNone, getFolderId(folderPath), newItem);
//}

View File

@ -178,7 +178,9 @@ public class Field {
FIELD_MAP.put("processed", new ExtendedFieldURI(0x65e8, ExtendedFieldURI.PropertyType.Boolean));
FIELD_MAP.put("reminderset", new UnindexedFieldURI("item:ReminderIsSet"));
FIELD_MAP.put("ismeeting", new UnindexedFieldURI("item:IsMeeting"));
FIELD_MAP.put("ismeeting", new UnindexedFieldURI("item:IsMeeting"));
FIELD_MAP.put("apptstateflags", new ExtendedFieldURI(ExtendedFieldURI.DistinguishedPropertySetType.Appointment, 0x8217, ExtendedFieldURI.PropertyType.Integer)); // PidLidAppointmentStateFlags 1: Meeting, 2: Received, 4: Cancelled
FIELD_MAP.put("calendaruid", new ExtendedFieldURI(ExtendedFieldURI.DistinguishedPropertySetType.PublicStrings, "urn:schemas:calendar:uid", ExtendedFieldURI.PropertyType.String));
// attachments
FIELD_MAP.put("attachments", new UnindexedFieldURI("item:Attachments"));