SampleApplication.zip (137.7 KB)
Hi,
we recently updated Aspose.Mail for .NET from version 18.8 to version 22.1 and noticed, that the “FetchItem” method of the EWSClient class seems to throw errors when fetching mails that contain attachments.
I attached a standalone console application with our use case to the ticket. The zip also contains two mails: one containing attachments and one without attachments.
The mail without attachments can be processed without errors, the mail with attachments causes the “FetchItem” method to fail.
Please refer to the following code sample (or the attached sample application) to see how we use Aspose.Mail to fetch items from EWS:
// Init client
using (IEWSClient client = EWSClient.GetEWSClient(mailboxUri, username, password, domain))
{
// Load all messages from a subfolder within the current mailbox
string subfolder = "";
ExchangeFolderInfo info = client.GetFolderInfo(subfolder);
ExchangeMessageInfoCollection messagesListSubfolder = client.ListMessages(info.Uri);
// Iterate messages from the subfolder
foreach (ExchangeMessageInfo mail in messagesListSubfolder)
{
try
{
// Throws error "System.ArgumentException The property data could not be null. Parametername: value" when email contains attachments
using (Aspose.Email.Mapi.MapiMessage msg = client.FetchItem(mail.UniqueUri))
{
}
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
}
}
Please let me know if you need more information on this topic.
Best Regards,
Michael