Ik heb een stuk code gemaakt om de entry's uit een distributielijst te lezen:
Dim oApp As Outlook.Application
' Get namespace and Contacts folder reference.
Dim oNS As Outlook.NameSpace
Dim addrListParent As Outlook.AddressList
Dim addrList As Object
Dim MyAddressEntries As Object
Dim objAE As Outlook.AddressEntry
Set oApp = New Outlook.Application
Set oNS = oApp.GetNamespace("MAPI")
For y = 1 To oNS.AddressLists.Count
If oNS.AddressLists(y) = "SalesNL" Then
Set addrListParent = oNS.AddressLists(y)
Exit For
End If
Next
For y = 1 To addrListParent.AddressEntries.Count
If addrListParent.AddressEntries(y) = "distrlijst1" Then
Set addrList = addrListParent.AddressEntries(y)
Exit For
End If
Next
For Each objAE In addrList.Members
strName = objAE.Name
strAddress = objAE.Address
Next
Dit werkt behoorlijk alleen krijg ik in strAddress nu het volgende:
"/o=Sales RO/ou=Cou Belgium/cn=Recipients/cn=Blabla"
Hoe krijg ik nu een goed mailadres?
Dim oApp As Outlook.Application
' Get namespace and Contacts folder reference.
Dim oNS As Outlook.NameSpace
Dim addrListParent As Outlook.AddressList
Dim addrList As Object
Dim MyAddressEntries As Object
Dim objAE As Outlook.AddressEntry
Set oApp = New Outlook.Application
Set oNS = oApp.GetNamespace("MAPI")
For y = 1 To oNS.AddressLists.Count
If oNS.AddressLists(y) = "SalesNL" Then
Set addrListParent = oNS.AddressLists(y)
Exit For
End If
Next
For y = 1 To addrListParent.AddressEntries.Count
If addrListParent.AddressEntries(y) = "distrlijst1" Then
Set addrList = addrListParent.AddressEntries(y)
Exit For
End If
Next
For Each objAE In addrList.Members
strName = objAE.Name
strAddress = objAE.Address
Next
Dit werkt behoorlijk alleen krijg ik in strAddress nu het volgende:
"/o=Sales RO/ou=Cou Belgium/cn=Recipients/cn=Blabla"
Hoe krijg ik nu een goed mailadres?