Browse our Products

Aspose.Email for Java 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
EMAILJAVA-35238Pst conversion issue on specific tnef emailBug
EMAILJAVA-35237ICS File is not importing in the Google mailBug

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:

try (OlmStorage olm = OlmStorage.fromFile("storage.olm")) {
    List<OlmItemCategory> categories = olm.getCategories();

    for (OlmItemCategory category : categories) {
        System.out.println("Category name: " + category.getName());

        //Color is represented as a hexadecimal value: #rrggbb
        System.out.println("Category color: " + category.getColor());
    }
}

Get a message category color:

for (MapiMessage msg : olm.enumerateMessages(folder)) {
    if (msg.getCategories() != null) {
        for (String msgCategory : msg.getCategories()) {
            System.out.println("Category name: " + msgCategory);
            String categoryColor = null;
            for (OlmItemCategory c : categories) {
                if (c.getName().equalsIgnoreCase(msgCategory)) {
                    categoryColor = c.getColor();
                    break;
                }
            }
            System.out.println("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

try (PersonalStorage pst = PersonalStorage.create("storage.pst", FileFormatVersion.Unicode)) {
    // Create a standard Contacts folder with the IPF.Contacts container class.
    FolderInfo 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).
    FolderCreationOptions fco = new FolderCreationOptions();
    fco.setEnforceContainerClassMatching(true);
    fco.setContainerClass("IPF.Note");
    contacts.addSubFolder("Subfolder3", fco);
}

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