Hydrogen-4
Hydrogen-4

Reputation: 207

Excel VBA Search Outlook GAL Using ExchangeUser Alias Property

I am trying to search trough a 200,000 plus Outlook GAL using Excel VBA and the only thing I have as a search parameter is the alias property.

This can be done from the Outlook >> Address Book >> Advanced Find dialog and it returns a result quite fast.

I tried something like going trough each item, calling the ExchangeUser object and compare the Alias property against my search but it takes way to long.

The source is a monthly report that contains and ever changing Excel list of about 100 Aliases and each must be searched in an Outlook GAL with over 200,000 entries.

Is there a way to do it pragmatically from Excel that responds as fast as the outlook dialog?

Upvotes: 0

Views: 1722

Answers (1)

Dmitry Streblechenko
Dmitry Streblechenko

Reputation: 66235

You can

  1. Use Application.Session.CreateRecipient / Recipient.Resolve and hope the alias resolves and there are no ambiguous entries. the search will be performed in all address book containers on the search path.

  2. Use Extended MAPI (C++ or Delphi) to have a restriction to be applied to GAL. Note that only very particular restriction can be applied - you would need to open the PR_SEARCH property as IMAPIContainer, set PR_ALIAS property, call IMAPIContainer::GetSearchCriteria, then apply that criteria to the GAL contents table.

  3. Use Redemption (any language, I am its author) - it exposes the RDOAddressListSearch object

Upvotes: 1

Related Questions