Search code examples
c#exchange-serverexchangewebservicesexchange-server-2010

EWS Resolve name doesn't return mailbox even if that exists in the exchange server


I'm trying to search for a mailbox from the exchange server using EWS service as below.

 ewsClient.ResolveName("[email protected]", ResolveNameSearchLocation.DirectoryThenContacts, true, props)

But it always returns an empty list means there is no mailbox in the exchange server having this address. Actually, that mailbox exists in exchange server and we can access it through PowerShell using

 Get-Mailbox "[email protected]"

Both EWS and PowerShell accessed using the same service account.

What's the issue might be?


Solution

  • The ResolveName operation in EWS will only return results for objects that are visible in the Global Address List. Get-Mailbox and the hiddenfromaddresslistsenabled property will show if its been hidden from the GAL.