Hi,
I'm fetching messages from an Exchange Server mailbox. This works fine as long as the size of the messages (their attachments) is not too big.
Recently I had to process a message of approx. 100Mb in size, which failed, resulting in a OutOfMemoryException (see attached file for stacktrace).
I'm using the following code:
---
NetworkCredential credential = new NetworkCredential(<username>, <password>, <domain>);
IEWSClient client = EWSClient.GetEWSClient(<uri>, credential);
ExchangeMessageInfoCollection msgs = client.ListMessages(client.MailboxInfo.InboxUri, true);
foreach (ExchangeMessageInfo msgInfo in msgs)
{
try
{
MailMessage msg = client.FetchMessage(msgInfo.UniqueUri);
}
catch (OutOfMemoryException e)
{
logger.error(e.ToString());
}
}
---
Question is how to process such large messages.
I'm fetching messages from an Exchange Server mailbox. This works fine as long as the size of the messages (their attachments) is not too big.
Recently I had to process a message of approx. 100Mb in size, which failed, resulting in a OutOfMemoryException (see attached file for stacktrace).
I'm using the following code:
---
NetworkCredential credential = new NetworkCredential(<username>, <password>, <domain>);
IEWSClient client = EWSClient.GetEWSClient(<uri>, credential);
ExchangeMessageInfoCollection msgs = client.ListMessages(client.MailboxInfo.InboxUri, true);
foreach (ExchangeMessageInfo msgInfo in msgs)
{
try
{
MailMessage msg = client.FetchMessage(msgInfo.UniqueUri);
}
catch (OutOfMemoryException e)
{
logger.error(e.ToString());
}
}
---
Question is how to process such large messages.
Many thanks in advance
Scheu