Skip to content
This repository has been archived by the owner on Jun 18, 2024. It is now read-only.

microsoft.exchange.webservices.data.core.exception.service.remote.ServiceRequestException: The request failed. An internal server error occurred. The operation failed. #746

Open
skenkre opened this issue Jun 17, 2021 · 2 comments · May be fixed by #768

Comments

@skenkre
Copy link

skenkre commented Jun 17, 2021

I get this error using EWS java api :

microsoft.exchange.webservices.data.core.exception.service.remote.ServiceRequestException: The request failed. An internal server error occurred. The operation failed.
at microsoft.exchange.webservices.data.core.request.SimpleServiceRequestBase.internalExecute(SimpleServiceRequestBase.java:74)
at microsoft.exchange.webservices.data.core.request.MultiResponseServiceRequest.execute(MultiResponseServiceRequest.java:158)
at microsoft.exchange.webservices.data.core.ExchangeService.internalFindFolders(ExchangeService.java:377)
at microsoft.exchange.webservices.data.core.ExchangeService.findFolders(ExchangeService.java:425)
at microsoft.exchange.webservices.data.core.ExchangeService.findFolders(ExchangeService.java:461)
at com.neustar.EWSOffice365Reader.main(EWSOffice365Reader.java:189)
Caused by: microsoft.exchange.webservices.data.core.exception.service.remote.ServiceResponseException: An internal server error occurred. The operation failed.
at microsoft.exchange.webservices.data.core.request.ServiceRequestBase.processWebException(ServiceRequestBase.java:548)
at microsoft.exchange.webservices.data.core.request.ServiceRequestBase.validateAndEmitRequest(ServiceRequestBase.java:641)
at microsoft.exchange.webservices.data.core.request.SimpleServiceRequestBase.internalExecute(SimpleServiceRequestBase.java:62)
... 5 more

The error is shown at below mentioned line.

FindFoldersResults findResults = service.findFolders(WellKnownFolderName.Inbox, folderview);

The service code is as below :

ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2010_SP2);
service.setUrl(new URI("https://outlook.office365.com/EWS/Exchange.asmx"));
BearerAccessToken bat = new BearerAccessToken(future.get().accessToken());
TokenCredentials credentials = new TokenCredentials(bat.getValue());
service.setImpersonatedUserId(new ImpersonatedUserId(ConnectingIdType.SmtpAddress , MAILBOX));
service.getHttpHeaders().put("X-AnchorMailbox", MAILBOX);
service.setCredentials(credentials);
service.setTraceEnabled(true);

I get the access token properly but the moment it comes across FindFoldersResults findResults it throws above mentioned exception.

@EATONJIANGHAHAHA
Copy link

EATONJIANGHAHAHA commented Aug 26, 2022

@skenkre We encountered the same problem. Did all your calls to EWS threw the same exception?

iaavo added a commit to iaavo/ews-java-api that referenced this issue Jan 27, 2023
This was referenced Jan 27, 2023
@iaavo
Copy link

iaavo commented Jan 27, 2023

Just wanted to bump this. I provided a PR to fix this.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants