Article ID: 171671
Article Last Modified on 5/9/2005
APPLIES TO
- Microsoft Collaboration Data Objects 1.1
- Microsoft Collaboration Data Objects 1.2
- Microsoft Collaboration Data Objects 1.21
This article was previously published under Q171671
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.
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
Change the properties or fields on the new AddressEntry object:
objAddress.Fields(ActMsgPR_SEND_RICH_INFO) = False
Call the Update method of the new AddressEntry object:
objAddress.Update
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: This code requires a reference to CDO (1.1, 1.2, 1.21) 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 = CdoTo 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
Keywords: kbmsg kbprb kbcode KB171671