ews-java-api icon indicating copy to clipboard operation
ews-java-api copied to clipboard

Java EWS - ResolveName not retrieving all email ids from Outlook

Open GitUserMK opened this issue 6 years ago • 3 comments

I am trying to retrieve list of users from Outlook using the Outlook API Exchange Webservices in a java stand alone application. To retrieve the list, I am using "resolveName". I find that sometimes when outlook returns multiple email ids for a name, the list that resolveName returns does not contain the last address. This does not happen with all the names that have multiple email ids returned by outlook. Example - if the name "John Test" returns 5 emails ids when manually searched for in Outlook, the method resolveName returns only 4 addresses. Does anybody have an idea of what might be happening here, or if I should use some method other than resolveName?

GitUserMK avatar Mar 13 '19 19:03 GitUserMK

I'm a bit confused about Outlook API. Could you show piece of code and raw EWS request and response for ResolveName request?

pkropachev avatar Mar 15 '19 17:03 pkropachev

The code that I use is this -

ExchangeService exchangeService = new ExchangeService(ExchangeVersion.Exchange2010_SP2); ExchangeCredentials credentials = new WebCredentials(username, password, domain); exchangeService.setCredentials(credentials); exchangeService.setUrl(URI.create("url to exchange")); NameResolutionCollection nameResults = exchangeService.resolveName("FirstName,LastName"); for (NameResolution name : nameResults) { emailAddr = name.getMailbox().getAddress(); }

When I manually lookup "FirstName,LastName" in outlook, I get 5 matching email addresses. But the above code snippet returns only 4 email addresses.

GitUserMK avatar Mar 18 '19 20:03 GitUserMK

It's quite interesting. Do you see any differences between contacts (contact that isn't found and contacts that are found)?

pkropachev avatar Apr 02 '19 11:04 pkropachev