I am trying to turn this into a late binding function to read the exchange address book within Outlook for vb.net using VS2003 but I suspect on any version. The reason I am using this is my boss does not want to have to import the reference for Outlook. Thanks for any help. This works if not using late binding. Thanks for any help.
' TODO: Replace My DL Name with a valid distribution list name.
Dim sDLName As String = "My DL Name"
' Create an Outlook application.
Dim oApp As Outlook._Application = New Outlook.Application()
' Get the MAPI namespace.
Dim oNS As Outlook.NameSpace = oApp.Session
' Get the Global Address List.
Dim oALs As Outlook.AddressLists = oNS.AddressLists
Dim oGal As Outlook.AddressList = oALs.Item("Global Address List")
' Get a specific Distribution List.
Dim oEntries As Outlook.AddressEntries = oGal.AddressEntries
' Reference the Distribution List by name.
Dim oDL As Outlook.AddressEntry = oEntries.Item(sDLName)
' Get all the members of the Distribution List.
oEntries = oDL.Members
Dim oEntry As Outlook.AddressEntry
Dim i As Integer
For i = 1 To oEntries.Count
oEntry = oEntries.Item(i)
' Clean up.
oEntry = Nothing
oEntries = Nothing
oGal = Nothing
oALs = Nothing
oNS = Nothing
oApp = Nothing