Microsoft KB Archive/194070

From BetaArchive Wiki

HOWTO: Use CDO (1.x) to Resolve Ambiguous Recipients



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 



REFERENCES

For more detailed specifics on the MAPI internals of how Ambiguous Name Resolution works, please see the following topics in the Microsoft Developer Network:

  • Implementing Name Resolution

For additional information, please see the following article in the Microsoft Knowledge Base:

Q171440 Where to Acquire Collaboration Data Objects Libraries

Additional query words:

Keywords : kbcode kbole kbCDO kbCDO100a kbCDO110 kbCDO120 kbCDO121 kbMsg kbVBp kbGrpMsg
Version : WINDOWS:1.0a,1.1,1.2,1.21
Platform : WINDOWS
Issue type : kbhowto
Technology :


Last Reviewed: April 27, 2000
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.