Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load Try ' 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("Contacts") ' Get all the entries. Dim oEntries As Outlook.AddressEntries = oGal.AddressEntries Dim oEntry As Outlook.AddressEntry Dim i As Integer For i = 1 To oEntries.Count oEntry = oEntries.Item(i) ComboBox1.Items.Add(oEntry.Name) Next Catch ex As Exception MessageBox.Show(ex.Message) End Try End Sub Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged Try ' 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("Contacts") ' Get all the entries. Dim oEntries As Outlook.AddressEntries = oGal.AddressEntries Dim oDL As Outlook.AddressEntry oDL = oEntries.Item(ComboBox1.SelectedItem.ToString) TextBox2.Text = oDL.GetContact.FullName Catch ex As Exception MessageBox.Show(ex.Message) End Try End Sub
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)