SelectNamesDialog.ShowOnlyInitialAddressList property (Outlook)

Returns or sets a Boolean that determines if the AddressList represented by SelectNamesDialog.InitialAddressList is the only AddressList available in the drop-down list for Address Book in the Select Names dialog box. Read/write.

Syntax

expression. ShowOnlyInitialAddressList

expression A variable that represents a SelectNamesDialog object.

Remarks

The default value of this property is False, meaning that all address lists are displayed. To restrict the drop-down list for Address Book to the one indicated by InitialAddressList, set ShowOnlyInitialAddressList to True.

If you don't set the InitialAddressList property and then set ShowOnlyInitialAddressList to True, then the AddressList with AddressList.IsInitialAddressList equal to True will be the only address list available in the drop-down list for Address Book.

Example

The following code sample shows how to use IsInitialAddressList and ShowOnlyInitialAddressList to have the Select Names dialog box always display only the address list in the default Contacts folder, regardless of the user's setting for the initial address list.

Sub ShowOnlyContacts() 
 
 Dim oMsg As MailItem 
 
 Set oMsg = Application.CreateItem(olMailItem) 
 
 
 
 Dim oDialog As SelectNamesDialog 
 
 Set oDialog = Application.Session.GetSelectNamesDialog 
 
 
 
 Dim oContacts As Folder 
 
 Set oContacts = _ 
 
 Application.Session.GetDefaultFolder(olFolderContacts) 
 
 
 
 Dim oAL As AddressList 
 
 For Each oAL In Application.Session.AddressLists 
 
 If oAL.GetContactsFolder = oContacts Then 
 
 Exit For 
 
 End If 
 
 Next 
 
 With oDialog 
 
 .InitialAddressList = oAL 
 
 .ShowOnlyInitialAddressList = True 
 
 .Recipients = oMsg.Recipients 
 
 If .Display Then 
 
 'Recipients Resolved 
 
 End If 
 
 End With 
 
End Sub

See also

SelectNamesDialog Object

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.