AddressList.GetContactsFolder メソッド (Outlook)

AddressList オブジェクトに対応する連絡先フォルダーを表す Folder オブジェクトを取得します。

構文

GetContactsFolder

AddressList オブジェクトを表す変数。

戻り値

Addresslist オブジェクトを見つけるの ための Outlook の連絡先フォルダーを表す Folder オブジェクトを返します。 Outlook の連絡先フォルダーが見つからない場合は、Null (Visual Basic の場合は Nothing) を返します。

注釈

このメソッドを使用すると、一致して、[ 名前の選択] ダイアログ ボックスで、初期のアドレス一覧として設定するには [連絡先] フォルダーには、 addresslist オブジェクトを見つける ことができます。

次のコード サンプルでは、既定の連絡先フォルダーの AddressList[名前の選択ダイアログ ボックスを初期化する方法を示します。 最初に、既定の Contacts フォルダーの Folder オブジェクトを取得し、この Folder オブジェクトのエントリ ID と、一致するものが見つかるまで現在のセッションの各 AddressList に関連付けられている Folder オブジェクトのエントリ ID を比較して、AddressList を検索します。 InitialAddressList プロパティを設定し、[ 名前の選択] ダイアログ ボックスを表示します。

Sub SetContactsFolderAsInitialAddressList() 
 
 Dim oMsg As MailItem 
 
 Set oMsg = Application.CreateItem(olMailItem) 
 
 Dim oDialog As SelectNamesDialog 
 
 Set oDialog = Application.Session.GetSelectNamesDialog 
 
 Dim oAL As AddressList 
 
 Dim oContacts As Folder 
 
 Set oContacts = _ 
 
 Application.Session.GetDefaultFolder(olFolderContacts) 
 
 
 
 On Error GoTo HandleError 
 
 'Look for the AddressList for the default Contacts folder 
 
 For Each oAL In Application.Session.AddressLists 
 
 If oAL.AddressListType = olOutlookAddressList Then 
 
 If oAL.GetContactsFolder.EntryID = _ 
 
 oContacts.EntryID Then 
 
 Exit For 
 
 End If 
 
 End If 
 
 Next 
 
 
 
 With oDialog 
 
 .Caption = "Select Customer Contact" 
 
 .ToLabel = "Customer C&ontact" 
 
 .NumberOfRecipientSelectors = olShowTo 
 
 .InitialAddressList = oAL 
 
 
 
 'Let the selected names be the recipients of the new message 
 
 .Recipients = oMsg.Recipients 
 
 
 
 If .Display Then 
 
 'Recipients Resolved 
 
 End If 
 
 End With 
 
 
 
HandleError: 
 
 Exit Sub 
 
End Sub

関連項目

AddressList オブジェクト

サポートとフィードバック

Office VBA またはこの説明書に関するご質問やフィードバックがありますか? サポートの受け方およびフィードバックをお寄せいただく方法のガイダンスについては、Office VBA のサポートおよびフィードバックを参照してください。