Browse our Products

Aspose.Email for Java 21.12 Release Notes

All Changes

KeySummaryCategory
EMAILNET-40230Zimbra calendars backup to PSTFeature
EMAILNET-40267Ability to skip exceptions while enumerating messages from OLM fileFeature
EMAILNET-40481Contacts API is being deprecated. Migrate to People API to retain programmatic access to Google ContactsEnhancement
EMAILJAVA-35001MailQueryBuilder.From.OrderBy throws KeyNotFoundExceptionBug
EMAILJAVA-34971Adding message to PST infinite loopBug

New Features

OLM file traversal API

The traversal API allows extracting all items as far as possible, without throwing out exceptions, even if some data of the original file is corrupted.

The following steps show how to use this API.

Use OlmStorage(TraversalExceptionsCallback callback) constructor and load(String fileName) method instead of fromFile method.

The constructor allows defining a callback method.

OlmStorage olm = new OlmStorage(new TraversalExceptionsCallback() {
    public void invoke(TraversalAsposeException exception, String itemId) {
        /* Exception handling  code. */
    }
});

Loading and traversal exceptions will be available through the callback method.

The load method returns 'true' if the file has been loaded successfully and further traversal is possible. If a file is corrupted and no traversal is possible, 'false' is returned.

if (olm.load(fileName))

Code example

TraversalExceptionsCallback exceptionsCallback = new TraversalExceptionsCallback() {
    public void invoke(TraversalAsposeException exception, String itemId) {
        /* Exception handling  code. */
    }
};
try (OlmStorage olm = new OlmStorage(exceptionsCallback)) {
    if (olm.load(fileName)) {
        List<OlmFolder> folderHierarchy = olm.getFolders();
        extractItems(olm, folderHierarchy);
    }
}

private static void extractItems(OlmStorage olm, List<OlmFolder> folders) {
    for (OlmFolder folder : folders) {
        if (folder.hasMessages()) {
            System.out.println(folder);

            for (MapiMessage msg : olm.enumerateMessages(folder)) {
                System.out.println(msg.getSubject());
            }
        }

        if (folder.getSubFolders().size() > 0) {
            extractItems(olm, folder.getSubFolders());
        }
    }
}

Export calendar and contact items from Zimbra backup files

We have implemented the export of Zimbra’s calendar and contacts to iCalendar and VCard formats.

Code example

try (TgzReader reader = new TgzReader("test2.tgz")) {
    //contacts files can be found in Contacts and Emailed Contacts subfolders
    //calendar files can be found in Calendar subfolder
    reader.exportTo("out");
}