1
0
mirror of https://github.com/moparisthebest/davmail synced 2024-12-13 11:12:22 -05:00

EWS: datereceived flag support

git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@1129 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
mguessan 2010-07-05 14:35:30 +00:00
parent e2fa43e9e1
commit f27a979fee
2 changed files with 24 additions and 3 deletions

View File

@ -181,9 +181,9 @@ public class EwsExchangeSession extends ExchangeSession {
if (bcc != null) {
ItemId itemId = new ItemId(createItemMethod.getResponseItem().get("ItemId"), createItemMethod.getResponseItem().get("ChangeKey"));
properties.put("bcc", bcc);
properties.remove("draft");
UpdateItemMethod updateItemMethod = new UpdateItemMethod(MessageDisposition.SaveOnly, ConflictResolution.AlwaysOverwrite, itemId, buildProperties(properties));
HashMap<String, String> localProperties = new HashMap<String, String>();
localProperties.put("bcc", bcc);
UpdateItemMethod updateItemMethod = new UpdateItemMethod(MessageDisposition.SaveOnly, ConflictResolution.AlwaysOverwrite, itemId, buildProperties(localProperties));
executeMethod(updateItemMethod);
}

View File

@ -24,6 +24,9 @@ import org.apache.log4j.Level;
import javax.mail.MessagingException;
import javax.mail.internet.MimeMessage;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.UUID;
@ -96,4 +99,22 @@ public class TestExchangeSessionMessageFlags extends AbstractExchangeSessionTest
assertEquals(1, messageList.size());
}
public void testCreateDateReceivedMessage() throws MessagingException, IOException {
MimeMessage mimeMessage = createMimeMessage();
String messageName = UUID.randomUUID().toString();
HashMap<String, String> properties = new HashMap<String, String>();
SimpleDateFormat dateFormatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
dateFormatter.setTimeZone(ExchangeSession.GMT_TIMEZONE);
Calendar cal = Calendar.getInstance();
cal.add(Calendar.MONTH, -1);
properties.put("datereceived", dateFormatter.format(cal.getTime()));
session.createMessage("testfolder", messageName, properties, getMimeBody(mimeMessage));
ExchangeSession.MessageList messageList = session.searchMessages("testfolder");
assertNotNull(messageList);
assertEquals(1, messageList.size());
assertNotNull(messageList);
assertEquals(properties.get("datereceived"), messageList.get(0).date);
}
}