Aspose.Email for .NET 20.6 Release Notes

All Changes

EMAILNET-39778Implement support for AQS search for EWS clientFeature
EMAILNET-39844Message to HTML - how to preserve embedded attachment’s icons and textFeature
EMAILNET-39852Support for getting Email Category in MHTMLFeature
EMAILNET-39835Add overload for SaveAs with Stream input in PersonalStorageEnhancement
EMAILNET-39834Add overload for MergeWith with Streams in PersonalStorageEnhancement
EMAILNET-39860MapiCalendar does not have public property for organizerEnhancement
EMAILNET-39858No messages are read from MBOXEnhancement
EMAILNET-39843Text wrapping getting disturbed in case of lengthy CC/TO fields in exported PDFEnhancement
EMAILNET-39839Table borders disappeared while converting msgBug
EMAILNET-39871Embedded images appearing in attachments of save MSGBug
EMAILNET-39853Attachments lost during Appointment to MapiCalendar conversionBug
EMAILNET-39856EML Content are not read properlyBug
EMAILNET-39865NullReferenceException on extracting messages form PSTBug
EMAILNET-39686Exchange.ListMessages returns nothingBug
EMAILNET-39854Incorrect PropertyDescriptor’s for the named properties in MapiMessage.PropertiesBug
EMAILNET-39869Parsing SOAP Fault message if an error occurs during EWSClient processingBug
EMAILNET-39855Exception on adding msg to PSTBug
EMAILNET-39861MapiCalendar does not save Attendees to ICSBug
EMAILNET-39842Multipart/related part marked with content-dispotion attachment missing in MailMessageBug

Advanced Query Search (AQS) search with EWSClient

Advanced Query Syntax (AQS) is the query syntax used by Exchange as an alternative to searching filters for expressing search criteria. AQS is a more flexible way to perform searches and deliver search results for all commonly used fields on the items. AQS is also user-friendly and easy to understand and quickly mastering. Using AQS is suitable for finding messages by attachments and recipients.

We have added the following classes to perform AQS search queries in Exchange:

  • ExchangeAdvancedSyntaxQueryBuilder - represents the builder of search expression based on the Advanced Query Syntax (AQS).
  • ExchangeAdvancedSyntaxMailQuery - implements an Advanced Query Syntax (AQS) search that is used by EWS.

Create a search query using query builder:

 using (IEWSClient client = EWSClient.GetEWSClient(exchangeMailboxUri, name, password))


    ExchangeAdvancedSyntaxQueryBuilder advancedBuilder = new ExchangeAdvancedSyntaxQueryBuilder();

    advancedBuilder.From.Equals("Jim Martin");



    ExchangeMessageInfoCollection messages = client.ListMessages(client.MailboxInfo.InboxUri, advancedBuilder.GetQuery());


Сreate a search query directly by using AQS:

  using (IEWSClient client = EWSClient.GetEWSClient(exchangeMailboxUri, name, password))


    ExchangeAdvancedSyntaxMailQuery query = new ExchangeAdvancedSyntaxMailQuery("subject:(product AND report)");

    ExchangeMessageInfoCollection messages = client.ListMessages(client.MailboxInfo.InboxUri, query);


See the syntax description.

Render custom icons in message attachment while HTML conversion

Sometimes, the message contains in-line attachments, that are shown up as icon images in a message body. Such messages may create problems while converting them to HTML, since the icon images are lost. This is because attachment’s icons are not held directly in the message.

We have fixed this problem so that the user can customize the icons for attachments when converting the message to HTML. For that, the HtmlSaveOptions.ResourceHtmlRendering event has been added added:

  var options = new HtmlSaveOptions();

options.ResourceHtmlRendering += SetAttachmentIcon;

options.ResourceRenderingMode = ResourceRenderingMode.SubstituteFromFile;

string fileName ="message.msg";

var mailMessage = MailMessage.Load(fileName);

mailMessage.Save(fileName + ".html", options);

 private static void SetAttachmentIcon(object sender, ResourceHtmlRenderingEventArgs e)


    AttachmentBase attachment = sender as AttachmentBase;

    e.Caption = attachment.ContentType.Name;

   if (attachment.ContentType.Name.EndsWith(".pdf"))


        e.PathToResourceFile = "pdf_icon.png";


   else if (attachment.ContentType.Name.EndsWith(".docx"))


        e.PathToResourceFile = "word_icon.jpg";


   else if (attachment.ContentType.Name.EndsWith(".jpg"))


        e.PathToResourceFile = "jpeg_icon.png";




        e.PathToResourceFile = "not_found_icon.png";



Get Email Category in MHTML

We have introduced the ability to add a category header while converting message to MHML.

 MapiMessage msg = new MapiMessage("", "", "subj", "body");

msg.Categories = new string[] { "Urgently", "Important" };

MhtSaveOptions saveOptions = new MhtSaveOptions();

saveOptions.FormatTemplates[MhtTemplateName.Categories] = saveOptions.FormatTemplates[MhtTemplateName.Categories].Replace("Categories", "Les catégories");


msg.Save(fileName + ".mhtml", saveOptions);