When I use the FetchMessage() method on the Aspose.Network.Exchange.ExchangeWebServiceClient class (verison 6.4) I don’t get the same e-mail headers as I get when using the Microsoft.Exchange.WebServices.Data.ExchangeService class.<?xml:namespace prefix = o ns = “urn:schemas-microsoft-com:office:office” />
Aspose code:
ExchangeWebServiceClient client = new ExchangeWebServiceClient(
“https://ourexchange.ourdomain.com/EWS/Exchange.asmx
”, “username”, “password”, “domain”);
ExchangeMessageInfoCollection msgCollection = client.ListMessages(client.MailboxInfo.InboxUri);
if (msgCollection.Count < 1)
return;
var msgInfo = msgCollection.Take(1).Single();
var mail = client.FetchMessage(msgInfo.UniqueUri);
TextWriter tw = new StreamWriter(@“C:\temp\AsposeNetwork6-4Output.txt”);
foreach (var header in mail.Headers.AllKeys)
{
tw.WriteLine(string.Format("{0}: {1}", header, mail.Headers[header]));
}
tw.Close();
Aspose output:
Received: from puff.ourdomain.com
(111.111.111.111) by rsbgchs01.ourdomain.com
(222.222.222.222) with Microsoft SMTP Server (TLS) id 8.3.137.0; Mon, 9 May 2011 10:50:02 +0200,from mail1.ourdomain.com
(Not Verified[111.123.19.7]) by puff.ourdomain.com
with MailMarshal (v6,8,2,9371) (using TLS: SSLv23) id ; Mon, 09 May 2011 10:49:58 +0200,from TSWWW01 (tswww01.test.ourdomain.com
[111.123.18.3]) by mail1.ourdomain.com
(8.13.1/8.13.1) with ESMTP id p498o2Dg023910 for <test.servicedesk@ourdomain.com
>; Mon, 9 May 2011 10:50:02 +0200
Content-Class: urn:content-classes:message
Thread-Topic: Övrigt
Thread-Index: AcwOJhYMEx7sw0dPQV6aln1hdRvchQ==
Accept-Language: en-US
Content-Language: en-US
X-MS-Exchange-Organization-AuthAs: Anonymous
X-MS-Exchange-Organization-AuthSource: rsbgchs01.ourdomain.com
X-MS-Has-Attach:
X-MS-TNEF-Correlator:
received-spf: Pass (domain ourdomain.com
designates 111.123.19.7 as a permitted sender), client-ip=<111.123.19.7>; identity=; helo=;
Content-Type: text/plain; charset=“iso-8859-1”
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
Microsoft code:
ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2007_SP1);
service.Credentials = new WebCredentials(“username”, “password”, “domain”);
service.Url = new Uri("https://ourexchange.ourdomain.com/EWS/Exchange.asmx
");
var itemList = service.FindItems(WellKnownFolderName.Inbox, new ItemView(1));
if (itemList.TotalCount < 1)
return;
service.LoadPropertiesForItems(itemList, PropertySet.FirstClassProperties);
var mail = itemList.Take(1).Single();
var test = mail as EmailMessage;
TextWriter tw = new StreamWriter(@“C:\temp\MSExchangeManagedApiOutput.txt”);
foreach (var header in mail.InternetMessageHeaders)
{
tw.WriteLine(string.Format("{0}: {1}", header.Name, header.Value));
}
tw.Close();
Microsoft output:
Received: from puff.ourdomain.com
(111.111.111.111) by rsbgchs01.ourdomain.com
(172.23.1.94) with Microsoft SMTP Server (TLS) id 8.3.137.0; Mon, 9 May 2011 10:50:02 +0200
Received: from mail1.ourdomain.com
(Not Verified[111.123.19.7]) by puff.ourdomain.com
with MailMarshal (v6,8,2,9371) (using TLS: SSLv23) id ; Mon, 09 May 2011 10:49:58 +0200
Received: from TSWWW01 (tswww01.test.ourdomain.com
[111.123.18.3]) by mail1.ourdomain.com
(8.13.1/8.13.1) with ESMTP id p498o2Dg023910 for <test.servicedesk@ourdomain.com
>; Mon, 9 May 2011 10:50:02 +0200
Received-SPF: Pass (domain ourdomain.com
designates 111.123.18.3 as a permitted sender), client-ip=<111.123.19.7>; identity=<firstname.lastname@ourdomain.com
>; helo=;
Message-ID: <201105090850.p498o2Dg023910@mail1.ourdomain.com
>
X-SVS-Username: Bcc0KDE
X-SVS-SSN: 445001059
MIME-Version: 1.0
Date: Mon, 9 May 2011 10:50:02 +0200
Subject: Övrigt
Content-Type: text/plain
Content-Transfer-Encoding: quoted-printable
Return-Path: firstname.lastname@ourdomain.com
As you can see from the above output the two custom headers X-SVS-Username and X-SVS-SSN are missing when using the Aspose API. Is this an expected behavior/by design? Is there anything I can do about it within your current API? Do you have any plans on changing this behavior? I would prefer not to have to use a mix of API’s to handle our e-mails with custom headers.