Argnist
Argnist

Reputation: 535

How to get company by user email from Active Directory?

How to get company by user email from Active Directory?

I use Microsoft.Exchange.WebServices.

 private const ExchangeVersion ExchangeVersion = Microsoft.Exchange.WebServices.Data.ExchangeVersion.Exchange2007_SP1;
 //...
 _exchangeService = new ExchangeService(ExchangeVersion);
 var collection = _exchangeService.ResolveName(userEmail);

It gives me one object with MailBox item (with proper email address) and Contact = null.

Upvotes: 2

Views: 72

Answers (1)

Alex Vazhev
Alex Vazhev

Reputation: 1471

ResolveName() returns NameResolutionCollection, NameResolution has a Contact property, the Contact property has collection of Companies.

https://msdn.microsoft.com/en-us/library/microsoft.exchange.webservices.data.contact.companies(v=exchg.80).aspx

Upvotes: 1

Related Questions