PRB: Changing Properties of AddressEntry object of a Recipient

Last reviewed: November 21, 1997
Article ID: Q171671
The information in this article applies to:
  • Collaboration Data Objects (CDO), version 1.1

SYMPTOMS

When attempting to change properties or fields of the AddressEntry object of a Recipient of a message, the property/field changes are not saved.

For example, using the following code, the change to the PR_SEND_RICH_INFO is not saved, as seen in the Details page that is displayed. (See the MORE INFORMATION section below for how the variables are defined.)

RESOLUTION

Follow these steps to make changes to the AddressEntry object of a recipient of a message. This code may be used to correct the complete code example provided in the MORE INFORMATION section below.

  1. After resolving the recipient, create a new AddressEntry object based on the AddressEntry property of the Recipient:

          Dim objAddress As Mapi.AddressEntry
          Set objAddress = objRecip.AddressEntry
    

  2. Change the properties or fields on the new AddressEntry object:

          objAddress.Fields(ActMsgPR_SEND_RICH_INFO) = False
    

  3. Call the Update method of the new AddressEntry object:

          objAddress.Update
    

  4. Set the AddressEntry property of the Recipient object to the AddressEntry object created in step 1 above:

          objRecip.AddressEntry = objAddress
    

MORE INFORMATION

Steps to Reproduce Behavior

The following code placed in a Visual Basic module will reproduce the problem described in the Symptoms section above. Note that the property change used here for illustration purposes assumes that the default setting of the PR_SEND_RICH_INFO property is True. If the default setting on your system is False, you will want to modify the code below to see the behavior.

' Note that you should have "Microsoft Active Messaging 1.1 Object
    ' Library" marked as a reference for your project in order for this
    ' code to function.
    Dim objSession As Session
    Dim objMessage As Mapi.Message
    Dim objRecip As Mapi.Recipient
    Dim objAddress As Mapi.AddressEntry

    ' Create and logon to a MAPI Session
    Set objSession = CreateObject("Mapi.Session")
    objSession.Logon ShowDialog:=True

    ' Create a new message
    Set objMessage = objSession.Outbox.Messages.Add

    ' Create a new recipient on our message
    Set objRecip = objMessage.Recipients.Add
    ' Set the properties of our recipient and resolve to a single address
    objRecip.Name = "myemail@mycompany.com"
    objRecip.Type = ActMsgTo
    objRecip.Resolve

    ' *** To make this code function as needed, replace this section
    ' *** of code with the corrected code provided in the Resolution
    ' *** section above.
    ' Attempt to set the PR_SEND_RICH_INFO property.
    ' This is the line of code that may need to change, depending on the
    ' default setting on your system.
    objRecip.AddressEntry.Fields(ActMsgPR_SEND_RICH_INFO) = False
    ' Update the AddressEntry object
    objRecip.AddressEntry.Update

    ' View the details of the Recipient to confirm changes
    objRecip.AddressEntry.Details

    ' Delete the message and Logoff the Session
    objMessage.Delete
    objSession.Logoff

REFERENCES

For additional information about Collaboration Data Objects versus Active Messaging, please see the following article in the Microsoft Knowledge Base:

   ARTICLE-ID: Q176916
   TITLE     : INFO: Active Messaging and Collaboration Data Objects (CDO)

Keywords          : kbcode ActMsg
Version           : WINDOWS:1.1
Platform          : WINDOWS
Issue type        : kbprb


================================================================================


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: November 21, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.