Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JAVA EWS item.load throws The request failed. Connection is still allocated

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

like image 958
shauli algawi Avatar asked Oct 31 '22 07:10

shauli algawi


1 Answers

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

like image 147
Sergiu Indrie Avatar answered Nov 09 '22 23:11

Sergiu Indrie