Solved

Email Body

Posted on 2016-09-08
4
45 Views
Last Modified: 2016-10-12
I have been asked to extract the mail from an outlook account problematically.

I have go so far but what I am getting is the entire email's trail.  Is there a means to get this information.

 
private void btnAddToSupportCall_Click(Office.CommandBarButton ctrl, ref bool cancel)
{
    string delimeter = "x###x";
    var emailAddress = this.Application.ActiveExplorer().Session.CurrentUser.AddressEntry.GetExchangeUser().PrimarySmtpAddress;

    Outlook.MailItem mailItem = Inspector.CurrentItem as Outlook.MailItem;
    string str = mailItem.SenderName + delimeter + mailItem.SenderEmailAddress + delimeter + mailItem.Subject + delimeter + mailItem.Body + delimeter + mailItem.ReceivedTime.Date.ToShortDateString() + delimeter + mailItem.ReceivedTime.ToShortTimeString();
    new FormAddEmailToSupportCall(str, delimeter, emailAddress).ShowDialog();
}

Open in new window

0
Comment
Question by:Alyanto
  • 2
  • 2
4 Comments
 
LVL 35

Expert Comment

by:Kimputer
Comment Utility
Hard to read what you actually mean.
Do you mean you want the internet headers of that email?
0
 

Author Comment

by:Alyanto
Comment Utility
Hi Kimputer
To clarify one of my colleagues asked me for a favour and then I used a spell checked without checking.  The the original should read.

I have been asked to extract the mail from an outlook account programmatically.

I have go so far but what I am getting is the entire email's trail.  Is there a means to get this information.  

I spoke to her again and what she wanted was to connect to an exchange server under a specific account and extract on arrival the last part of an email's chain.  The code above is what was sent to me  by her.  I am hoping some has done this sort of thing before and has a bit of stock code they could share.

Kind regards

Alyanto
0
 
LVL 35

Accepted Solution

by:
Kimputer earned 500 total points
Comment Utility
It's what I thought. Here's code for not the last part, but the full header (which obviously contains the last part).
Since she or you are probably more C# savvy, I only have the VB code. Please translate it to C# yourself.

private void btnAddToSupportCall_Click(Office.CommandBarButton ctrl, ref bool cancel)
{
    string delimeter = "x###x";
    var emailAddress = this.Application.ActiveExplorer().Session.CurrentUser.AddressEntry.GetExchangeUser().PrimarySmtpAddress;

    Outlook.MailItem mailItem = Inspector.CurrentItem as Outlook.MailItem;
	
	'.net Visual Basic code
	Const PR_TRANSPORT_MESSAGE_HEADERS = "http://schemas.microsoft.com/mapi/proptag/0x007D001E"
    Dim olkPA As Outlook.PropertyAccessor
    Set olkPA = mailItem.PropertyAccessor
    FullInetHeaders = olkPA.GetProperty(PR_TRANSPORT_MESSAGE_HEADERS)
    Set olkPA = Nothing
	' end .net Visual Basic code
	
    string str = FullInetHeaders + delimeter +  mailItem.SenderName + delimeter + mailItem.SenderEmailAddress + delimeter + mailItem.Subject + delimeter + mailItem.Body + delimeter + mailItem.ReceivedTime.Date.ToShortDateString() + delimeter + mailItem.ReceivedTime.ToShortTimeString();
    new FormAddEmailToSupportCall(str, delimeter, emailAddress).ShowDialog();
}

Open in new window

0
 

Author Closing Comment

by:Alyanto
Comment Utility
I finally got an answer from our junior and he has been able to move the problem based on the ideas here.
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

This process describes the steps required to Import and Export data from and to .pst files using Exchange 2010. We can use these steps to export data from a user to a .pst file, import data back to the same or a different user, or even import data t…
Learn to move / copy / export exchange contacts to iPhone without using any software. Also see the issues in configuration of exchange with iPhone to migrate contacts.
To show how to generate a certificate request in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.:  First we need to log into the Exchange Admin Center. Navigate to the Servers >> Certificates…
The video tutorial explains the basics of the Exchange server Database Availability groups. The components of this video include: 1. Automatic Failover 2. Failover Clustering 3. Active Manager

763 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

10 Experts available now in Live!

Get 1:1 Help Now