• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 517
  • Last Modified:

Email body for Outlook region using VB.net

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
TheChos
Asked:
TheChos
  • 3
1 Solution
 
Jesus RodriguezIT ManagerCommented:
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
 
TheChosAuthor Commented:
This doesn't reference the email that I currently have open.
0
 
TheChosAuthor Commented:
I was able to resolve the above issue using Outlook.MailItem.
0
 
TheChosAuthor Commented:
Used Outlook.MailItem to determine the current email information.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: CompTIA Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

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