Update Method (AddressEntry Object)

Update Method (AddressEntry Object)

The Update method saves changes to the AddressEntry object in the MAPI system.

Syntax

objAddressEntry.Update( [makePermanent] [, refreshObject**] )**

objAddressEntry

Required. The AddressEntry object.

makePermanent

Optional. Boolean. A value of True indicates that the property cache is flushed and all changes are committed in the underlying address book container. False indicates that the property cache is flushed but not committed to persistent storage. The default value is True.

refreshObject

Optional. Boolean. A value of True indicates that the property cache is reloaded from the values in the underlying address book container. False indicates that the property cache is not reloaded. The default value is False.

Remarks

Changes to objects are not permanently saved in the MAPI system until you call the Update method with the makePermanent parameter set to True.

For improved performance, CDO caches property changes in private storage and updates either the object or the underlying persistent storage only when you explicitly request such an update. For efficiency, you should make only one call to Update with its makePermanent parameter set to True.

The makePermanent and refreshObject parameters combine to cause the following changes:

 

refreshObject = True

refreshObject = False

makePermanent = True

Commit all changes, flush the cache, and reload the cache from the address book.

Commit all changes and flush the cache (default combination).

makePermanent = False

Flush the cache and reload the cache from the address book.

Flush the cache.

Calling Update(False, True) flushes the cache and then reloads the appropriate values from the address book. This effectively cancels any changes that had been made to the AddressEntry object in memory.

The user must have the appropriate permission to Add, Delete, or Update an AddressEntry object. Most users have this permission only for their personal address book (PAB).

Example

The following code fragment changes the display name for a valid AddressEntry object:

' Function: AddressEntry_Update
' Purpose: Demonstrate the Update method
Function AddressEntry_Update()
Dim objRecipColl As Recipients ' Recipients collection
Dim objNewRecip As Recipient   ' New recipient

' error handling omitted ...
Set objRecipColl = objSession.AddressBook
If objRecipColl Is Nothing Then
    MsgBox "must select someone from the address book"
    Exit Function
End If
Set objNewRecip = objRecipColl.Item(1)
' above could be objRecipColl(1) since .Item is default property
With objNewRecip.AddressEntry
    .Name = .Name & " MD, PhD"
    .Type = "X.500" ' you can also change the Type
    .Update         ' defaults to makePermanent = True
End With
MsgBox "Updated address entry name: " & objNewRecip.AddressEntry.Name
Exit Function
' error handling omitted
End Function
 

See Also

Concepts

AddressEntry Object