Search code examples
c#exchange-serverexchangewebservicesews-managed-api

Moving batch of EmailMessages using EWS Managed API


Is it possible to move list of EmailMessage through one request to Exchange Web Service? The only way how to move one message is EmailMessage.Move method:

Item item = beforeMessage.Move(WellKnownFolderName.JunkEmail)

Is there any possibility for a batch of items?


Solution

  • Use the MoveItems method eg ExchangeService.MoveItems https://msdn.microsoft.com/en-us/library/office/microsoft.exchange.webservices.data.exchangeservice.moveitems(v=exchg.80).aspx which will batch the request. I would be careful around optimising your batch sizes to avoid throttling issues.