命名空间 GetSelectNamesDialog 方法 (Outlook)NameSpace.GetSelectNamesDialog method (Outlook)

获取当前会话的**SelectNamesDialog** 对象。Obtains a SelectNamesDialog object for the current session.

语法Syntax

expressionexpression. GetSelectNamesDialog

_表达式_一个代表 "NameSpace" 对象的变量。expression A variable that represents a 'NameSpace' object.

返回值Return value

当前会话的SelectNamesDialog对象。A SelectNamesDialog object for the current session. SelectNamesDialog 对象支持显示用户当前会话中的一个或多个地址列表中选择项的 选择姓名对话框。The SelectNamesDialog object supports displaying the Select Names dialog box for the user to select entries from one or more address lists in the current session.

示例Example

下面的代码示例演示如何实例化当前会话的SelectNamesDialog实例, 并使用它在与 Outlook 用户的 "选择姓名" 对话框类似的对话框中显示 "联系人" 文件夹中的条目。交互.The following code sample shows how to instantiate an instance of SelectNamesDialog for the current session, and use it to display entries from the Contacts folder in a dialog box that resembles the Select Names dialog box in the Outlook user interface.

Sub ShowContactsInDialog() 
 Dim oDialog As SelectNamesDialog 
 Dim oAL As AddressList 
 Dim oContacts As Folder 
 
 Set oDialog = Application.Session.GetSelectNamesDialog 
 Set oContacts = _ 
 Application.Session.GetDefaultFolder(olFolderContacts) 
 
 'Look for the address list that corresponds with the Contacts folder 
 For Each oAL In Application.Session.AddressLists 
 If oAL.GetContactsFolder = oContacts Then 
 Exit For 
 End If 
 Next 
 With oDialog 
 'Initialize the dialog box with the address list representing the Contacts folder 
 .InitialAddressList = oAL 
 .ShowOnlyInitialAddressList = True 
 If .Display Then 
 'Recipients Resolved 
 'Access Recipients using oDialog.Recipients 
 End If 
 End With 
End Sub

另请参阅See also

命名空间对象NameSpace Object

支持和反馈Support and feedback

有关于 Office VBA 或本文档的疑问或反馈?Have questions or feedback about Office VBA or this documentation? 请参阅 Office VBA 支持和反馈,获取有关如何接收支持和提供反馈的指南。Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.