'A LDAP recipient not being resolved correctly when calling Recipient.Resolve

I am developing an outlook Addin c# using outlook object model. My Addin code needs to resolve the recipient in order to act on it based on its resolved type (AddressEntryUserType).

I use the Recipient.Resolve() method which is working good enough. However, the problem is that when sending a message while entering an address in the "To" field, the email (which I know for a fact that it should be an LDAP entry) does not resolve to an LDAP entry. Instead, it is resolved to be an SMTP address entry. I have no way to know in the code that this is actually an LDAP entry.

Note: when pressing the "To" button and using the address book to select the LDAP entry. the Recipient resolves correctly.

What should I do in this case? is there a way to overcome this issue? any help would be appreciated.



Solution 1:[1]

(Based on the comments for the original question) - If you want to resolve a name against a particular AB container, you can either uses Extended MAPI (C++ or Delphi only) and call IABContainer.ResolveNames. If that fails, you can try to use PR_ANR restriction against that container's contents table.

If Extended MAPI is not an option, you can use Redemption (I am its author) and its RDOAddressList.ResolveName method. It will use the two approaches outlined above and is accessible from any language.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1