Solved

Email body for Outlook region using VB.net

Posted on 2014-01-02
4
483 Views
Last Modified: 2014-01-08
I've developed an Outlook Messagebox region and would like to be able to set one of my fields equal to the contents of the email being written.  Any direction on how to accomplish would be appreciated.

Thanks.
0
Comment
Question by:TheChos
  • 3
4 Comments
 
LVL 13

Expert Comment

by:Jesus Rodriguez
Comment Utility
Create an outlook addin Application and then do something like this

    Private Sub Application_NewMail() Handles Application.NewMail
        Dim tempApp As Outlook.Application
        Dim tempInbox As Outlook.MAPIFolder
        Dim InboxItems As Outlook.Items
        tempApp = CreateObject("Outlook.Application")
        tempInbox = tempApp.GetNamespace("Mapi").GetDefaultFolder(Outlook.OlDefaultFolders.olFolderInbox)
        InboxItems = tempInbox.Items
        Dim newMail As Outlook.MailItem

        Dim inBox As Outlook.MAPIFolder = Me.Application.ActiveExplorer().Session.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderInbox)
        Dim DestinationFolder As Outlook.MAPIFolder = inBox.Folders("Processed")
        For Each newMail In InboxItems
            Dim Des As String = newMail.Body
           'On Des variable you will have the body of the message for each new email that comes to the inbox
       Next

Open in new window

0
 

Author Comment

by:TheChos
Comment Utility
This doesn't reference the email that I currently have open.
0
 

Accepted Solution

by:
TheChos earned 0 total points
Comment Utility
I was able to resolve the above issue using Outlook.MailItem.
0
 

Author Closing Comment

by:TheChos
Comment Utility
Used Outlook.MailItem to determine the current email information.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Total in textboxes 9 34
windbg taking it's time 32 49
DataGridview Currency Formating? 22 37
c# if statement weird reaction 3 28
For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

762 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now