mirror of
https://github.com/moparisthebest/davmail
synced 2024-12-21 23:18:49 -05:00
EWS: implement batch move items
git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@2319 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
parent
1acddc4954
commit
4a918cd22e
@ -18,6 +18,8 @@
|
|||||||
*/
|
*/
|
||||||
package davmail.exchange.ews;
|
package davmail.exchange.ews;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copy item to another folder.
|
* Copy item to another folder.
|
||||||
*/
|
*/
|
||||||
@ -33,4 +35,17 @@ public class CopyItemMethod extends EWSMethod {
|
|||||||
this.itemId = itemId;
|
this.itemId = itemId;
|
||||||
this.toFolderId = toFolderId;
|
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);
|
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
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
@ -1243,6 +1257,20 @@ public class EwsExchangeSession extends ExchangeSession {
|
|||||||
executeMethod(copyItemMethod);
|
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
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user