Browse our Products

Aspose.Email for .NET 24.2 Release Notes

All Changes

KeySummaryCategory
EMAILNET-40862Retrieve category colors from an OLMFeature
EMAILNET-41268The specified container class of the added folder (IPF.Imap) does not match the container class of the parent folder (IPF.Note)Enhancement
EMAILNET-41257Investigation of adding a folder with a container class not matching parent folder classEnhancement
EMAILNET-40923MapiMessage.Body is empty sometimesBug
EMAILNET-41274ICS File is not importing in the Google mailBug
EMAILNET-41269Detecting msg file encodingBug
EMAILNET-41263Incorrect saving Appointment to ICS formatBug

New Features

Retrieve Category Colors from an OLM

Discover and utilize category colors associated with Outlook item categories stored in OLM files.

  • Introducing a new class OlmItemCategory to represent Outlook item categories. Categories are available by their name and associated colors, represented in hexadecimal format.
  • Added a new method GetCategories() to the OlmStorage class for retrieving category list.

Code Examples

Get all used categories from OML storage:

using (var olm = OlmStorage.FromFile("storage.olm"))
{
    var categories = olm.GetCategories();
    
    foreach (var category in categories)
    {
        Console.WriteLine($"Category name: {category.Name}");
        
		//Color is represented as a hexadecimal value: #rrggbb
        Console.WriteLine($"Category color: {category.Color}");
    }
}

Get a message category color:

foreach (var msg in olm.EnumerateMessages(folder))
{
    if (msg.Categories != null)
    {
        foreach (var msgCategory in msg.Categories)
        {
            Console.WriteLine($"Category name: {msgCategory}");
            var categoryColor = cat.First(c => c.Name.Equals(msgCategory, StringComparison.OrdinalIgnoreCase)).Color;
            Console.WriteLine($"Category color: {categoryColor}");
        }
    }
}

Strict Container Class Matching Check when Adding a Folder to PST

This feature adds an additional layer of validation during folder creation, preventing mismatches in container classes and maintaining the organizational hierarchy of PST storage files. Added a new property EnforceContainerClassMatching to the FolderCreationOptions class. This property specifies whether to enforce checking the container class of the folder being added against the container class of the parent folder. If set to true, an exception will be thrown if the container classes do not match. Default is false.

Code Sample

using (var pst = PersonalStorage.Create("storage.pst", FileFormatVersion.Unicode))
{
    // Create a standard Contacts folder with the IPF.Contacts container class.
    var contacts = pst.CreatePredefinedFolder("Contacts", StandardIpmFolder.Contacts);
    
    // An exception will not arise. EnforceContainerClassMatching is false by default.
    contacts.AddSubFolder("Subfolder1", "IPF.Note");
    
    // An exception will occur as the container class of the subfolder being added (IPF.Note) 
    // does not match the container class of the parent folder (IPF.Contact).
    contacts.AddSubFolder("Subfolder3", new FolderCreationOptions {EnforceContainerClassMatching = true, ContainerClass = "IPF.Note"});
}

Note: Ensure proper handling of exceptions when enforcing container class matching to prevent unexpected behavior during folder creation in PST.