Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ews-java-api cannot initialize ExchangeService #749

Open
pipibilibili opened this issue Dec 6, 2021 · 1 comment
Open

ews-java-api cannot initialize ExchangeService #749

pipibilibili opened this issue Dec 6, 2021 · 1 comment

Comments

@pipibilibili
Copy link

ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2010_SP2);
ExchangeCredentials credentials = new WebCredentials("xxxx@163.com", "xxxxx");
service.setCredentials(credentials);
service.autodiscoverUrl("xxxx@163.com");

Exception in thread "main" microsoft.exchange.webservices.data.autodiscover.exception.AutodiscoverLocalException: The Autodiscover service couldn't be located.
at microsoft.exchange.webservices.data.autodiscover.AutodiscoverService.internalGetLegacyUserSettings(AutodiscoverService.java:742)
at microsoft.exchange.webservices.data.autodiscover.AutodiscoverService.getLegacyUserSettings(AutodiscoverService.java:521)
at microsoft.exchange.webservices.data.autodiscover.AutodiscoverService.internalGetLegacyUserSettings(AutodiscoverService.java:959)
at microsoft.exchange.webservices.data.autodiscover.AutodiscoverService.getUserSettings(AutodiscoverService.java:1846)
at microsoft.exchange.webservices.data.core.ExchangeService.getAutodiscoverUrl(ExchangeService.java:3615)
at microsoft.exchange.webservices.data.core.ExchangeService.autodiscoverUrl(ExchangeService.java:3572)
at microsoft.exchange.webservices.data.core.ExchangeService.autodiscoverUrl(ExchangeService.java:3522)
at EwsTest.main(EwsTest.java:29)

@ThangLeQuoc
Copy link

ThangLeQuoc commented Dec 20, 2021

Possibly your credential initialization is wrong, did you try the alternative contructor with domain?

ExchangeCredentials ewsCredential = new WebCredentials(ewsUserName, ewsPassword, ewsDomain);  
exchangeService = new ExchangeService(ExchangeVersion.Exchange2010_SP1);	 
exchangeService.setCredentials(ewsCredential);  

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

No branches or pull requests

2 participants