Platform SDK: CDO 1.2.1

Changing an Existing Address Entry

The CDO Library lets you change existing address entries in any address book container for which you have modification permission. Typically you have such permission only for your personal address book (PAB).

To change an existing address entry

  1. Select the AddressEntry object to modify. You can obtain the AddressEntry object in several ways, including the following:
  2. Change individual properties of the AddressEntry object, such as the Address, Name, or Type property.
  3. Call the AddressEntry object’s Update method.

The following sample code demonstrates this procedure:

' Function: AddressEntry_Update 
' Purpose: Demonstrate the Update method 
' See documentation topic: Update method AddressEntry object 
Function AddressEntry_Update() 
Dim objRecipColl As Recipients  ' Recipients collection 
Dim objNewRecip As Recipient    ' New recipient object 
 
On Error GoTo error_olemsg 
If objSession Is Nothing Then 
    MsgBox "must log on first" 
    Exit Function 
End If 
Set objRecipColl = objSession.AddressBook ' let user select 
If objRecipColl Is Nothing Then 
    MsgBox "must select someone from the address book" 
    Exit Function 
End If 
Set objNewRecip = objRecipColl.Item(1) 
With objNewRecip.AddressEntry 
    .Name = .Name & " the Magnificent" 
    .Type = "X.500" ' you can update the type, too ... 
    .Update 
End With 
MsgBox "Updated address entry name: " & objNewRecip.AddressEntry.Name 
Exit Function 
 
error_olemsg: 
MsgBox "Error " & Str(Err) & ": " & Error$(Err) 
Resume Next 
 
End Function 
 

See Also

Using Addresses, Creating a New Address Book Entry, Selecting Recipients from the Address Book