' list all contacts in outlook
' taken from Example05.vb
Private Sub Example05Main()

   ' start outlook
   Dim outlookApplication = New Outlook.Application()

   ' enum contacts 
   Dim contactFolder As Outlook.MAPIFolder = _
outlookApplication.Session.GetDefaultFolder(OlDefaultFolders.olFolderContacts) For index As Integer = 1 To contactFolder.Items.Count If (TypeName(contactFolder.Items(index)) = "ContactItem") Then Dim contact As Outlook.ContactItem = contactFolder.Items(index) Dim listItem As ListViewItem = listView1.Items.Add(index.ToString()) listItem.SubItems.Add(contact.CompanyAndFullName) End If Next index 'close outlook and dispose outlookApplication.Quit() outlookApplication.Dispose() End Sub

Last edited Jun 13, 2012 at 11:10 AM by SebastianDotNet, version 3


No comments yet.