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

Caldav: implement task categories over EWS

git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@1769 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
mguessan 2011-08-08 20:11:15 +00:00
parent 1d6794dc2a
commit 50d0bc585a
3 changed files with 11 additions and 8 deletions

View File

@ -1363,7 +1363,7 @@ public class DavExchangeSession extends ExchangeSession {
}
private byte[] getICSFromItemProperties() throws IOException {
byte[] result = null;
byte[] result;
// experimental: build VCALENDAR from properties
@ -1482,7 +1482,7 @@ public class DavExchangeSession extends ExchangeSession {
// Parse attendee list
String toHeader = getPropertyIfExists(davPropertySet, "to");
if (toHeader != null && !organizerEmail.equals(toHeader)) {
if (toHeader != null && !toHeader.equals(organizerEmail)) {
InternetAddress[] attendees = InternetAddress.parseHeader(toHeader, false);
for (InternetAddress attendee : attendees) {
if (!attendee.getAddress().equalsIgnoreCase(organizerEmail)) {

View File

@ -399,7 +399,6 @@ public class EwsExchangeSession extends ExchangeSession {
@Override
public void createMessage(String folderPath, String messageName, HashMap<String, String> properties, MimeMessage mimeMessage) throws IOException {
EWSMethod.Item item = new EWSMethod.Item();
item.type = "Message";
ByteArrayOutputStream baos = new ByteArrayOutputStream();
try {
mimeMessage.writeTo(baos);
@ -1248,10 +1247,11 @@ public class EwsExchangeSession extends ExchangeSession {
updates.add(Field.createFieldUpdate("percentcomplete", percentComplete));
String vTodoStatus = vCalendar.getFirstVeventPropertyValue("STATUS");
if (vTodoStatus == null) {
updates.add(Field.createFieldUpdate("status", "NotStarted"));
updates.add(Field.createFieldUpdate("taskstatus", "NotStarted"));
} else {
updates.add(Field.createFieldUpdate("status", vTodoToTaskStatusMap.get(vTodoStatus)));
updates.add(Field.createFieldUpdate("taskstatus", vTodoToTaskStatusMap.get(vTodoStatus)));
}
updates.add(Field.createFieldUpdate("keywords", vCalendar.getFirstVeventPropertyValue("CATEGORIES")));
updates.add(Field.createFieldUpdate("duedate", convertCalendarDateToExchange(vCalendar.getFirstVeventPropertyValue("DUE"))));
if (currentItemId != null) {
// update
@ -1381,8 +1381,9 @@ public class EwsExchangeSession extends ExchangeSession {
getItemMethod.addAdditionalProperty(Field.get("calendaruid"));
getItemMethod.addAdditionalProperty(Field.get("description"));
getItemMethod.addAdditionalProperty(Field.get("percentcomplete"));
getItemMethod.addAdditionalProperty(Field.get("status"));
getItemMethod.addAdditionalProperty(Field.get("taskstatus"));
getItemMethod.addAdditionalProperty(Field.get("duedate"));
getItemMethod.addAdditionalProperty(Field.get("keywords"));
} else if (!"Message".equals(type)) {
getItemMethod = new GetItemMethod(BaseShape.ID_ONLY, itemId, true);
getItemMethod.addAdditionalProperty(Field.get("reminderset"));
@ -1415,7 +1416,9 @@ public class EwsExchangeSession extends ExchangeSession {
vTodo.setPropertyValue("SUMMARY", getItemMethod.getResponseItem().get(Field.get("subject").getResponseName()));
vTodo.setPropertyValue("DESCRIPTION", getItemMethod.getResponseItem().get(Field.get("description").getResponseName()));
vTodo.setPropertyValue("PERCENT-COMPLETE", getItemMethod.getResponseItem().get(Field.get("percentcomplete").getResponseName()));
vTodo.setPropertyValue("STATUS", taskTovTodoStatusMap.get(getItemMethod.getResponseItem().get(Field.get("status").getResponseName())));
vTodo.setPropertyValue("STATUS", taskTovTodoStatusMap.get(getItemMethod.getResponseItem().get(Field.get("taskstatus").getResponseName())));
vTodo.setPropertyValue("CATEGORIES", getItemMethod.getResponseItem().get(Field.get("keywords").getResponseName()));
VProperty vProperty = new VProperty("DUE", convertDateFromExchange(getItemMethod.getResponseItem().get(Field.get("duedate").getResponseName())));
vProperty.setParam("TZID", vTimezone.getPropertyValue("TZID"));
vTodo.addProperty(vProperty);

View File

@ -209,7 +209,7 @@ public final class Field {
// task
FIELD_MAP.put("percentcomplete", new UnindexedFieldURI("task:PercentComplete"));
FIELD_MAP.put("status", new UnindexedFieldURI("task:Status"));
FIELD_MAP.put("taskstatus", new UnindexedFieldURI("task:Status"));
FIELD_MAP.put("duedate", new UnindexedFieldURI("task:DueDate"));
// attachments