Aspose.Email for Java 22.11 Release Notes

All Changes

KeySummaryCategory
EMAILNET-40856Add DecodeSignedContent method to MapiMessageFeature
EMAILNET-40783Provide API to check subfolder is from StandardIpmFolderFeature
EMAILNET-40808Add features for TNEFFeature
EMAILNET-40814Working with StickyNote, DistList and IPM.DocumentEnhancement
EMAILNET-40839Issues while reading distribution ListBug
EMAILNET-40826Storage.ItemMoved event does not workBug
EMAILNET-40825InvalidOperationException is thrown while merging PSTBug
EMAILNET-40828Unable to access read only storage fileBug
EMAILNET-40793Headers From/To are lost after MSG to EML conversionBug
EMAILNET-40854Image attachments are not rendered in the attachments list after MSG to PDF conversionBug
EMAILNET-40840Aspose.Email.AsposeArgumentOutOfRangeException is thrown while loading VCSBug
EMAILNET-40813MSG to MHTML: Images not convertedBug
EMAILNET-40833Email address with quotesBug

New Features

Getting a MAPI item type

We have added the MapiItemType enum that represented an item type. It can be used for message conversion into an object of a corresponding class derived from the IMapiMessageItem interface. This avoids users from checking the MessageClass property value before message conversion.

Usage:

for (MessageInfo messageInfo : folder.enumerateMessages()) {
    MapiMessage msg = pst.extractMessage(messageInfo);

    switch (msg.getSupportedType()) {
        // Non-supported type. MapiMessage cannot be converted to an appropriate item type.
        // Just use in MSG format.
        case MapiItemType.None:
            break;
        // An email message. Conversion isn't required.
        case MapiItemType.Message:
            break;
        // A contact item. Can be converted to MapiContact.
        case MapiItemType.Contact:
            MapiContact contact = (MapiContact) msg.toMapiMessageItem();
            break;
        // A calendar item. Can be converted to MapiCalendar.
        case MapiItemType.Calendar:
            MapiCalendar calendar = (MapiCalendar) msg.toMapiMessageItem();
            break;
        // A distribution list. Can be converted to MapiDistributionList.
        case MapiItemType.DistList:
            MapiDistributionList dl = (MapiDistributionList) msg.toMapiMessageItem();
            break;
        // A Journal entry. Can be converted to MapiJournal.
        case MapiItemType.Journal:
            MapiJournal journal = (MapiJournal) msg.toMapiMessageItem();
            break;
        // A StickyNote. Can be converted to MapiNote.
        case MapiItemType.Note:
            MapiNote note = (MapiNote) msg.toMapiMessageItem();
            break;
        // A Task item. Can be converted to MapiTask.
        case MapiItemType.Task:
            MapiTask task = (MapiTask) msg.toMapiMessageItem();
            break;
    }
}

Removing a Signature from a MapiMessage

For better compatibility, the MapiMessage.removeSignature method and MapiMessage.isSigned property were added.

Code example:

MapiMessage msg = MapiMessage.load(fileName);

if (msg.isSigned()) {
    MapiMessage unsignedMsg = msg.removeSignature();
}

Checking whether the folder is in a predefined folder

Added FolderInfo.getPredefinedType(boolean getForTopLevelParent) method, to check folder is from StandardIpmFolder.

If getForTopLevelParent param is true, method returns a StandardIpmFolder enum value for the top-level parent folder. This determines whether the current folder is a subfolder of a predefined folder. If getForTopLevelParent param is false, it returns a StandardIpmFolder enum value for the current folder.

String fileName = "my.pst";

try (PersonalStorage pst = PersonalStorage.fromFile(fileName)) {
    checkFolders(pst.getRootFolder().getSubFolders());
}

private void checkFolders(FolderInfoCollection folders) {
    for (FolderInfo folder : folders) {
        System.out.println("Display Name: " + folder.getDisplayName());

        // Determines whether the current folder is a predefined folder
        int folderType = folder.getPredefinedType(false);
        String answer = folderType == StandardIpmFolder.Unspecified ? "No" : "Yes, " + folderType;
        System.out.println("Is StandardIpmFolder?: " + answer);

        // Determines whether the current folder is a subfolder of a predefined folder
        if (folderType == StandardIpmFolder.Unspecified) {
            folderType = folder.getPredefinedType(true);
            answer = folderType == StandardIpmFolder.Unspecified ? "No" : "Yes, " + folderType;
            System.out.println("Is subfolder from StandardIpmFolder parent?: " + answer);
        }

        System.out.println();

        checkFolders(folder.getSubFolders());
    }
}

Checking whether attachment is a TNEF formatted message

The Attachment.isTnef property indicates whether the message attachment is TNEF formatted message.

Usage:

MailMessage eml = MailMessage.load(fileName);

for (Attachment attachment : eml.getAttachments()) {
    System.out.println("Is Attachment TNEF?: " + attachment.isTnef());
}