Showing the Address Book
If you’re writing an application that allows the user to enter recipients for an outgoing message, it’s convenient for the user to have a way to display the address book, and to select recipients directly from the address book. In CDO, this is done by calling the Session object’s AddressBook method. The syntax of the AddressBook method is:
SetCdoRecipients
= CdoSession.AddressBook([Recipients
][,Title
][,OneAddress
] [,ForceResolution
][,RecipLists
][,ToLabel
][,CcLabel
][,BccLabel
][,ParentWindow
])
Note that all of the parameters are optional. Here is how each is used:
-
Recipients
A Recipients collection object that is used to populate the addresses in the dialog box. The user can then select additional addresses and/or deselect addresses that were previously selected. If the parameter is omitted, the displayed dialog box doesn’t have any recipients selected initially.
-
Title
A string that is used as the dialog box’s caption. The default value is an empty string.
-
OneAddress
When this Boolean parameter is set to
True
, the user is permitted to select at most a single recipient. When it isFalse
(the default), the user is allowed to select multiple recipients.-
ForceResolution
When this Boolean parameter is set to
True
, the AddressBook method attempts to resolve all names prior to returning. If it has trouble doing so, it displays an address resolution dialog box to the user, as shown in Figure 6-6. If this parameter is set toFalse
, the AddressBook method ...
Get CDO & MAPI Programming with Visual Basic: now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.