Commit 71513ef6 authored by Mickaël Guessant's avatar Mickaël Guessant

EWS: implement batch move items

git-svn-id: https://svn.code.sf.net/p/davmail/code/trunk@2319 3d1905a2-6b24-0410-a738-b14d5a86fcbd
parent 9fe090b5
......@@ -18,6 +18,8 @@
*/
package davmail.exchange.ews;
import java.util.List;
/**
* Copy item to another folder.
*/
......@@ -33,4 +35,17 @@ public class CopyItemMethod extends EWSMethod {
this.itemId = itemId;
this.toFolderId = toFolderId;
}
/**
* Copy items to target folder.
*
* @param itemIds item id list
* @param toFolderId target folder id
*/
public CopyItemMethod(List<ItemId> itemIds, FolderId toFolderId) {
super("Item", "CopyItem");
this.itemIds = itemIds;
this.toFolderId = toFolderId;
}
}
......@@ -1234,6 +1234,20 @@ public class EwsExchangeSession extends ExchangeSession {
executeMethod(moveItemMethod);
}
/**
* @inheritDoc
*/
@Override
public void moveMessages(List<ExchangeSession.Message> messages, String targetFolder) throws IOException {
ArrayList<ItemId> itemIds = new ArrayList<ItemId>();
for (ExchangeSession.Message message: messages) {
itemIds.add(((EwsExchangeSession.Message) message).itemId);
}
MoveItemMethod moveItemMethod = new MoveItemMethod(itemIds, getFolderId(targetFolder));
executeMethod(moveItemMethod);
}
/**
* @inheritDoc
*/
......@@ -1243,6 +1257,20 @@ public class EwsExchangeSession extends ExchangeSession {
executeMethod(copyItemMethod);
}
/**
* @inheritDoc
*/
@Override
public void copyMessages(List<ExchangeSession.Message> messages, String targetFolder) throws IOException {
ArrayList<ItemId> itemIds = new ArrayList<ItemId>();
for (ExchangeSession.Message message: messages) {
itemIds.add(((EwsExchangeSession.Message) message).itemId);
}
CopyItemMethod copyItemMethod = new CopyItemMethod(itemIds, getFolderId(targetFolder));
executeMethod(copyItemMethod);
}
/**
* @inheritDoc
*/
......
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