We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

System.InvalidOperationException

windows 2008 / 64 bit
Aspose Network 5.4.0.4 (hotfix)

This happens when trying to retrieve a message:

Client found response content type of ‘’, but expected ‘text/xml’.
The request failed with an empty response.
System.InvalidOperationException: Client found response content type of ‘’, but expected ‘text/xml’.
The request failed with an empty response.
at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall)
at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)
at Aspose.Network.Exchange.Schema.ExchangeServiceBinding.GetItem(GetItemType GetItem1)
at Aspose.Network.Exchange.ExchangeWebServiceClient.SaveMessage(String messageUri, Stream stream)
at Aspose.Network.Exchange.ExchangeWebServiceClient.FetchMessage(String messageUri)
at project.EWSClient.getMailMessage(ExchangeMessageInfo message)
at project.ServiceMain.ruleMatch(ExchangeMessageInfo message)
at project.ServiceMain.searchMessages()

actually this is when trying to fetch a read receipt so i guess i cant call it a bug, but still that error is highly inappropriate

Hi,


I am sorry, I could not reproduce this error using v5.4.0.4 hotfix and Exchange 2007 using ExchangeWebServiceClient class.

I used the below scenario:
  1. create new email in Outlook and set option for receiving “read receipt"
  2. send email, receive email with another recipient, send the read receipt
  3. use the code below to read/fetch messages from Inbox (including the read receipt)
NetworkCredential credential = new NetworkCredential(username, password, domain);
ExchangeWebServiceClient client = new ExchangeWebServiceClient(mailboxURI, credential);

Console.WriteLine(“Getting messages from mailbox…”);
ExchangeMessageInfoCollection msgInfoColl = client.ListMessages(client.GetMailboxInfo().InboxUri);
foreach (ExchangeMessageInfo msgInfo in msgInfoColl)
{
// Get rid of characters like ? and :, which should not be included in a file name
string fileName = msgInfo.Subject.Replace(”:", " “).Replace(”?", " ");

{
Console.WriteLine("Subject: " + msgInfo.Subject);
MailMessage message = client.FetchMessage(msgInfo.UniqueUri);
message.Save(fileName + “.msg”, MailMessageSaveType.OutlookMessageFormat);
}
}

Attached is the saved read receipt in MSG format, saved by MailMessage.Save() method above.