Solved

Email Body

Posted on 2016-09-08
4
73 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
ID: 41789602
Hard to read what you actually mean.
Do you mean you want the internet headers of that email?
0
 
LVL 1

Author Comment

by:Alyanto
ID: 41791043
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
ID: 41791234
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
 
LVL 1

Author Closing Comment

by:Alyanto
ID: 41840073
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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Lotus Notes – formerly IBM Notes – is an email client application, while IBM Domino (earlier Lotus Domino) is an email server. The client possesses a set of features that are even more advanced as compared to that of Outlook. Likewise, IBM Domino is…
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
In this Micro Video tutorial you will learn the basics about Database Availability Groups and How to configure one using a live Exchange Server Environment. The video tutorial explains the basics of the Exchange server Database Availability grou…
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

808 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