Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 572
  • Last Modified:

Retrieve email addresses from an email in outlook

Hi all,
   I am developing an outlook addin in vb.net using VSTO. I am trying to retrieve information from an email and I can do everything fine except retrieving email addresses. I can easily get the senders email by using the .senderEmailAddress but this does not exsist for to,cc,bcc. When I use to,cc, or bcc only the persons name comes up and not the email address. Would anyone have a way of getting around this? Below is a smaill snippet of code:


Thanks In Advance

Dim objApp As Outlook.Application
            Dim msg As Outlook.MailItem
            objApp = CreateObject("Outlook.Application")
            msg = objApp.ActiveInspector.CurrentItem
            Me.txtSubject.Text = msg.Subject
            Me.txtNotes.Text = msg.Body
            Me.txtFromEmail.Text = msg.SenderEmailAddress

Open in new window

0
yazbek
Asked:
yazbek
1 Solution
 
Wayne Taylor (webtubbs)Commented:
Use the Recipients collection.....
    Dim rpt As Recipient
    For Each rpt In msg.Recipients
        'Recipient.Type enum values in comments
        Select Case rpt.Type
            Case olBCC '3
                MsgBox "BCC Recipient Address = " & rpt.Address
            Case olCC '2
                MsgBox "CC Recipient Address = " & rpt.Address
            Case olTo '1
                MsgBox "TO Recipient Address = " & rpt.Address
        End Select
    Next

Open in new window

0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now