Commit d2757a52 authored by Mickaël Guessant's avatar Mickaël Guessant

Caldav: EWS refactoring, implement allday, sensitivity and categories update

git-svn-id: https://svn.code.sf.net/p/davmail/code/trunk@2511 3d1905a2-6b24-0410-a738-b14d5a86fcbd
parent 32666891
......@@ -377,7 +377,7 @@ public class VProperty {
if (c == ',' &&
// multivalued properties
("N".equals(key) ||
"CATEGORIES".equals(key) ||
//"CATEGORIES".equals(key) ||
"NICKNAME".equals(key)
)) {
// convert multiple values to multiline values (e.g. street)
......
......@@ -1559,8 +1559,31 @@ public class EwsExchangeSession extends ExchangeSession {
// TODO: update all event fields and handle other occurrences
updates.add(Field.createFieldUpdate("dtstart", convertCalendarDateToExchange(vCalendar.getFirstVeventPropertyValue("DTSTART"))));
updates.add(Field.createFieldUpdate("dtend", convertCalendarDateToExchange(vCalendar.getFirstVeventPropertyValue("DTEND"))));
updates.add(Field.createFieldUpdate("isalldayevent", Boolean.toString(vCalendar.isCdoAllDay())));
String eventClass = vCalendar.getFirstVeventPropertyValue("CLASS");
if ("PRIVATE".equals(eventClass)) {
eventClass = "Private";
} else if ("CONFIDENTIAL".equals(eventClass)) {
eventClass = "Confidential";
} else {
// PUBLIC
eventClass = "Normal";
}
updates.add(Field.createFieldUpdate("itemsensitivity", eventClass));
updates.add(Field.createFieldUpdate("description", vCalendar.getFirstVeventPropertyValue("DESCRIPTION")));
updates.add(Field.createFieldUpdate("location", vCalendar.getFirstVeventPropertyValue("LOCATION")));
// Collect categories on multiple lines
List<VProperty> categories = vCalendar.getFirstVevent().getProperties("CATEGORIES");
if (categories != null) {
HashSet<String> categoryValues = new HashSet<String>();
for (VProperty category: categories) {
categoryValues.add(category.getValue());
}
updates.add(Field.createFieldUpdate("keywords", StringUtil.join(categoryValues, ",")));
}
VProperty rrule = vCalendar.getFirstVevent().getProperty("RRULE");
if (rrule != null) {
......@@ -1696,8 +1719,8 @@ public class EwsExchangeSession extends ExchangeSession {
} else {
// update existing item
if (currentItemId != null && /*) {
if (*/vCalendar.isMeeting() && !vCalendar.isMeetingOrganizer()) {
if (currentItemId != null) {
if (vCalendar.isMeeting() && !vCalendar.isMeetingOrganizer()) {
// This is a meeting response
EWSMethod.Item item = new EWSMethod.Item();
......@@ -1708,12 +1731,12 @@ public class EwsExchangeSession extends ExchangeSession {
getFolderId(SENT),
item
);
/*} else {
} else {
createOrUpdateItemMethod = new UpdateItemMethod(MessageDisposition.SaveOnly,
ConflictResolution.AutoResolve,
SendMeetingInvitationsOrCancellations.SendToAllAndSaveCopy,
currentItemId, buildFieldUpdates(vCalendar));
}*/
}
} else {
// create
EWSMethod.Item newItem = new EWSMethod.Item();
......
......@@ -200,6 +200,9 @@ public final class Field {
FIELD_MAP.put("private", new ExtendedFieldURI(ExtendedFieldURI.DistinguishedPropertySetType.Common, 0x8506, ExtendedFieldURI.PropertyType.Boolean));
FIELD_MAP.put("sensitivity", new ExtendedFieldURI(0x0036, ExtendedFieldURI.PropertyType.Integer));
// TODO: merge with sensitivity ?
FIELD_MAP.put("itemsensitivity", new UnindexedFieldURI("item:Sensitivity"));
FIELD_MAP.put("haspicture", new ExtendedFieldURI(ExtendedFieldURI.DistinguishedPropertySetType.Address, 0x8015, ExtendedFieldURI.PropertyType.Boolean));
FIELD_MAP.put("fburl", new ExtendedFieldURI(ExtendedFieldURI.DistinguishedPropertySetType.Address, 0x80D8, ExtendedFieldURI.PropertyType.String));
......@@ -222,6 +225,10 @@ public final class Field {
FIELD_MAP.put("optionalattendees", new UnindexedFieldURI("calendar:OptionalAttendees"));
FIELD_MAP.put("modifiedoccurrences", new UnindexedFieldURI("calendar:ModifiedOccurrences"));
FIELD_MAP.put("recurrence", new UnindexedFieldURI("calendar:Recurrence"));
FIELD_MAP.put("isalldayevent", new UnindexedFieldURI("calendar:IsAllDayEvent"));
// does not work with Office 365, see https://msdn.microsoft.com/en-us/library/office/bb204271(v=exchg.150).aspx
//FIELD_MAP.put("isrecurring", new UnindexedFieldURI("calendar:IsRecurring"));
FIELD_MAP.put("isrecurring", new ExtendedFieldURI(ExtendedFieldURI.DistinguishedPropertySetType.Appointment, 0x8223, ExtendedFieldURI.PropertyType.Boolean)); // PidLidRecurring
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment