Partager via


DistListItem.GetMember Method (Outlook)

Returns a Recipient object representing a member in a distribution list.

Syntax

expression .GetMember(Index)

expression A variable that represents a DistListItem object.

Parameters

Name

Required/Optional

Data Type

Description

Index

Required

Long

The index number of the member to be retrieved.

Return Value

A Recipient object representing the specified member.

Example

This Microsoft Visual Basic for Applications (VBA) example locates every distribution list in the default Contacts folder and determines whether the list contains the current user.

Sub DisplayYourDLNames() 
 
 Dim myNameSpace As Outlook.NameSpace 
 
 Dim myFolder As Outlook.Folder 
 
 Dim myDistList As Outlook.DistListItem 
 
 Dim myFolderItems As Outlook.Items 
 
 Dim x As Integer 
 
 Dim y As Integer 
 
 Dim iCount As Integer 
 
 
 
 Set myNameSpace = Application.GetNamespace("MAPI") 
 
 Set myFolder = myNameSpace.GetDefaultFolder(olFolderContacts) 
 
 Set myFolderItems = myFolder.Items 
 
 iCount = myFolderItems.Count 
 
 For x = 1 To iCount 
 
 If TypeName(myFolderItems.Item(x)) = "DistListItem" Then 
 
 Set myDistList = myFolderItems.Item(x) 
 
 For y = 1 To myDistList.MemberCount 
 
 If myDistList.GetMember(y).Name = myNameSpace.CurrentUser.Name Then 
 
 MsgBox "Your are a member of " & myDistList.DLName 
 
 End If 
 
 Next y 
 
 End If 
 
 Next x 
 
End Sub

See Also

Concepts

DistListItem Object Members

DistListItem Object