Reading another mailbox Address

L

Leanne

With the help of Sue's drag and drop sample code, I was able to get dragging
and dropping email to a form working in vb.net. The problem I am having is
getting the exchange recipient email address for another mailbox. I have the
code working to get the exchange users email addresses but it's failing when
a recipient is another mailbox. Here's the code I'm using. Thanks for any
assistance

Dim recipients As Outlook.Recipients = mail.Recipients

If recipients IsNot Nothing Then
Try
For i As Integer = 1 To recipients.Count
Dim recipient As Outlook.Recipient = recipients.Item(i)

If recipient IsNot Nothing Then

If recipient.Type = CInt(recipientType) Then
Dim entry As Outlook.AddressEntry =
recipient.AddressEntry()

If entry IsNot Nothing Then
Try
If entry.Type.ToString.ToUpper =
"EX" Then

If entry.getexchangeuser Is
Nothing Then

listBoxItems.Add(recipient.Name & "@somewhere.com") 'WORKS WITH THIS LINE
BUT IS THERE A BETTER WAY????
Else

listBoxItems.Add(entry.getexchangeuser.primarysmtpaddress())
End If

Else
listBoxItems.Add(entry.Address)
End If

End If
End If

End If
Next

End If
 
D

Dmitry Streblechenko

What exactly does not work?
Are you trying to retrieve the SMTP address of an EX user when the AD
hosting that user detaisl is not available?
You cannot do that: the primary SMTP address is stored in the AD, so it
needs to be accessible, there is no way around that.

--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top