Hi All experts, require your help for an issue.
I have a task to import the members of Distribution list. I am using Outlook 2010 and configured 2 mails.
I am able to find and get the members of Distribution List from the first mail box/GAL. The same code is not working to search the second Mail GAL. If I manually searched the outlook am able to see that DL but from the code.
Could someone please help on this, i tried a lot and it is giving me nuts.
The below code works for first Mail box GAL and it is always searching in that GAL only.
Sub GetDGMembers()
Dim olApp As Outlook.Application
Dim olNS As Outlook.Namespace
Dim olAL As Outlook.AddressList
Dim olEntry As Outlook.AddressEntry
Dim olMember As Outlook.AddressEntry
Dim lMemberCount As Long
Dim objMail As Outlook.MailItem
Set olApp = Outlook.Application
Set olNS = olApp.GetNamespace("MAPI")
Set olAL = olNS.AddressLists("Global Address List")
Set objMail = olApp.CreateItem(olMailItem)
' enter the list name
Set olEntry = olAL.AddressEntries(".DL Support")
' get count of dist list members
lMemberCount = olEntry.Members.Count
' loop through dist list and extract members
Dim i As Long
For i = 1 To lMemberCount
'my process update in sheet
Next i
End Sub
Please suggest how to access the second GAL to get DL members.
Appreciate your support help in this regard.
I have a task to import the members of Distribution list. I am using Outlook 2010 and configured 2 mails.
I am able to find and get the members of Distribution List from the first mail box/GAL. The same code is not working to search the second Mail GAL. If I manually searched the outlook am able to see that DL but from the code.
Could someone please help on this, i tried a lot and it is giving me nuts.
The below code works for first Mail box GAL and it is always searching in that GAL only.
Sub GetDGMembers()
Dim olApp As Outlook.Application
Dim olNS As Outlook.Namespace
Dim olAL As Outlook.AddressList
Dim olEntry As Outlook.AddressEntry
Dim olMember As Outlook.AddressEntry
Dim lMemberCount As Long
Dim objMail As Outlook.MailItem
Set olApp = Outlook.Application
Set olNS = olApp.GetNamespace("MAPI")
Set olAL = olNS.AddressLists("Global Address List")
Set objMail = olApp.CreateItem(olMailItem)
' enter the list name
Set olEntry = olAL.AddressEntries(".DL Support")
' get count of dist list members
lMemberCount = olEntry.Members.Count
' loop through dist list and extract members
Dim i As Long
For i = 1 To lMemberCount
'my process update in sheet
Next i
End Sub
Please suggest how to access the second GAL to get DL members.
Appreciate your support help in this regard.