That looks in your Contact folder - which might be what you want. Or else you can use the Global Address List from Exchange:
Find address in GAL:
VB Code:
'Set A Reference to the Microsoft Outlook Object Library
Private olApp As Outlook.Application
Private olNS As Outlook.NameSpace
Private olAL As Outlook.AddressList
Private olAE As Outlook.AddressEntry
Private olMail As Outlook.MailItem
Private Sub Form_Load()
Dim Counter As Long
Set olApp = New Outlook.Application
Set olNS = olApp.GetNamespace("MAPI")
For Each olAL In olNS.AddressLists
For Each olAE In olAL.AddressEntries
DoEvents
Counter = Counter + 1
Label1.Caption = Counter
ListView1.ListItems.Add , , olAE.Name
ListView1.ListItems(ListView1.ListItems.Count).SubItems(1) = olAE.Address
Next
Next
End Sub
Or else you can use the normal name resolution:
Put a Microsoft MAPI Session and MAPI Messages control on the form:
VB Code:
MAPISession1.SignOn
With MAPIMessages1
.SessionID = MAPISession1.SessionID
.Compose
.ResolveName
.AddressResolveUI = True
.MsgSubject = "My Subject"
.MsgNoteText = "My body"
.AttachmentIndex = 0
.AttachmentPosition = 0
.AttachmentPathName = "c:\temp\test.txt"
.Send
End With
MAPISession1.SignOff