获取嵌套的distibution列表成员

时间:2018-03-16 09:39:16

标签: excel-vba outlook-vba vba excel

我需要检索包含多个其他通讯组列表的通讯组列表的所有成员。

示例:分发列表包含John和Jack成员。它还包含DL - SampleA,SampleB和SampleC。

此代码检索成员John和Jack,但不检索其中的DL成员。有没有办法获得DL的成员 - SampleA,SampleB和SampleC?

Sub DLu()

Dim objOL As Outlook.Application
Dim olNmspc As Outlook.Namespace
Dim objRecip As Outlook.Recipient
Dim objMembers As AddressEntries
Dim objMember As AddressEntry
Dim dMemCnt As Integer
Dim i As Integer

Set objOL = New Outlook.Application

Set olNmspc = objOL.GetNamespace("MAPI")
olNmspc.Logon

Set objRecip = olNmspc.CreateRecipient("Distribution List ")

If objRecip.AddressEntry.GetExchangeUser Is Nothing Then
    If objRecip.Resolve Then
        Set objMembers = objRecip.AddressEntry.Members

        dMemCnt = objMembers.Count

        For i = 1 To dMemCnt
            Set objMember = objMembers.Item(i)
            Debug.Print objMember
        Next i

    End If
End If
End Sub

1 个答案:

答案 0 :(得分:0)

创建一个带有//We pass the unique channel id as the second parameter in the constructor NotificationCompat.Builder notificationCompatBuilder=new NotificationCompat.Builder(this,NOTIFICATION_CHANNEL_ID); //Title for your notification notificationCompatBuilder.setContentTitle("This is title"); //Subtext for your notification notificationCompatBuilder.setContentText("This is subtext"); //Small Icon for your notificatiom notificationCompatBuilder.setSmallIcon(R.id.icon); //Large Icon for your notification notificationCompatBuilder.setLargeIcon( BitmapFactory.decodeResource(getResources(),R.id.icon)); notificationManager.notify( NOTIFICATION_ID,notificationCompatBuilder.build()); 类型参数的函数。调用该函数传递AddressEntries作为参数。该函数可以检查objRecip.AddressEntry.Members是否为空(其中AddressEntry.Members对象来自AddressEntry集合),然后递归调用自身。