Solved

Retrieve email addresses from an email in outlook

Posted on 2008-06-17
1
564 Views
Last Modified: 2013-11-26
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
Comment
Question by:yazbek
1 Comment
 
LVL 47

Accepted Solution

by:
Wayne Taylor (webtubbs) earned 250 total points
ID: 21810900
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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Are you using email marketing software? If not, you're missing out on effortless marketing and the reaching of desired conversion rates through email marketing software.
The purpose of this video is to demonstrate how to set up an account with Mailchimp. This will be demonstrated using a Windows 8 PC. Tools Used are: Mailchimp.com Go to Mailchimp.com : Enter an Email, Username, and Password. Click Create My Acco…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question