Microsoft KB Archive/194070

-

The information in this article applies to:


 * Collaboration Data Objects (CDO), versions 1.0a, 1.1, 1.2, 1.21

-

SUMMARY
When Resolving the Name of a Recipient to an alias of a user (for example, JohnDoe), if there is another valid alias (JohnDoeman, for instance) that is a superset of the first alias, the Resolve method yields an Ambiguous Name Resolution (ANR) dialog box.

This article addresses how to programmatically handle this scenario.

MORE INFORMATION
The following Visual Basic code sample demonstrates how to resolve an ambiguous recipient given a known exact alias of the desired recipient. This process works by using the "=" operator preceding the e-mail alias:

  Sub Main 'This code sample depends on a local reference to the Collaboration 'Data Objects Library (1.1, 1.2, 1.21). '    Dim objSession As MAPI.Session Dim objMessage As Message Dim objRecip As Recipient

'Create a Session and Logon. Set objSession = CreateObject("mapi.session") objSession.Logon

'Create the Message and add the Recipient. Set objMessage = objSession.Outbox.Messages.Add Set objRecip = objMessage.Recipients.Add objRecip.Name = "=JohnDoe" 'Enter desired alias w/preceeding "=" objRecip.Resolve

'Set the remainder of the Message Properties and Send. objMessage.Subject = "Subject:" & Now objMessage.Text = "This is the message text." objMessage.Send

'Exit objSession.LOGOFF

End Sub