I hope anyone could help me. I'm building a web client email using the EWS Java API.
This is the code snippet that throws the exception:
if (mailList != null){
for (Item item : mailList.getItems()){
synchronized (item) {
es = Utils.initiateExchangeService(mailAccountData);
em = EmailMessage.bind(es, item.getId(), emPropSet);
item.load(new PropertySet(BasePropertySet.FirstClassProperties));
The line that throws the exception is:
item.load(new PropertySet(BasePropertySet.FirstClassProperties));
I know that this exception is usually get thrown while we use the same instance of the ExchangeService class, but not here.
appreciate any help
The only solution so far seems to be using a single ExchangeService instance and synchronizing access to it (only allow one thread at a time).
https://github.com/OfficeDev/ews-java-api/issues/276
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With