Update Method

Microsoft Outlook Visual Basic

Update Method

       

The Update method posts a change to the AddressEntry object in the messaging system.

expression.Update(MakePermanent, Refresh)

expression   Required. An expression that returns an AddressEntry object.

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

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

Remarks

New entries or changes to existing entries are not persisted in the collection until the Update method has been called with its MakePermanent parameter set to True.

To flush the cache and then reload the values from the address book, call Update with the MakePermanent parameter set to False and the Refresh parameter set to True.

Example

This Visual Basic for Applications example uses the Add method to add a new AddressEntry object to the Personal Address Book. The Name value, John Q. Public, is necessary to avoid errors.

If this entry already exists, the code skips to DialogBox:. The Details method displays a dialog box that shows the information for this entry.

    Set myOlApp = CreateObject("Outlook.Application")
    Set myNamespace = myOlApp.GetNamespace("MAPI")
    Set myAddrList = myNamespace.AddressLists("Personal Address Book")
    Set myAddrEntries = myAddrList.AddressEntries
    Set myEntry = myAddrEntries.Add("Microsoft Mail Address")
    myEntry.Name = "John Q. Public"
    On Error GoTo DialogBox
    myEntry.Address = "[email protected]"
    myEntry.Update
    DialogBox:
    myEntry.Details