OfficeDev / ews-java-api

A java client library to access Exchange web services. The API works against Office 365 Exchange Online as well as on premises Exchange.
MIT License
867 stars 557 forks source link

Error when deleting big amount of emails #737

Open SummerXia93 opened 3 years ago

SummerXia93 commented 3 years ago

Hi, I am getting errors when trying to delete a big amount of emails via this tool. The first bunch of emails are deleted with no problem. Then the api throw some error out.

An internal server error occurred. The operation failed. ErrorInternalServerError-> ErrorQuotaExceededOnDelete-> Cannot delete message because the destination folder is out of quota.

Why is this happening and how can I fix it?

Thanks,

SummerXia93 commented 3 years ago

I tried single delete and batch delete all throw the same error.

The APIs I am using are these:

service.deleteItems(itemIds, DeleteMode.HardDelete, SendCancellationsMode.SendToNone, AffectedTaskOccurrence.AllOccurrences);

item.delete(DeleteMode.HardDelete);