Working with Zimbra

About Zimbra

Zimbra is an email, calendar and collaboration suite built for the cloud. Zimbra includes complete email, contacts, calendar, file sharing, tasks and messaging/videoconferencing, all accessed from the Zimbra Web Client from any device.

Read all messages from Zimbra TGZ storage

Aspose.Email provides the TgzReader class to read Zimbra TGZ storage files. The following sample code demonstrates the use of the TgzReader class to read all messages from the file. 

Get Total Items Count from a Tgz File

The GetTotalItemsCount() method of the TgzReader class will return the total number of message items contained in the storage.

The following code sample will show you how to implement this method in your project:

using (TgzReader reader = new TgzReader(fileName))
{
    int count = reader.GetTotalItemsCount();
}

Save Messages and Directory Structure

You may also save all the message with directory structure from the Zimbra TGZ storage file. For this, the TgzReader class provides a method ExportTo which takes the output path as a parameter.

The following code snippet demonstrates the use of the TgzReader.ExportTo method to save all messages from the Zimbra TGZ storage file.

Export Calendar and Contact Items from Zimbra Backup Files

To export Zimbra’s calendar and contacts and save them in iCalendar and VCard formats, you can use the following code snippet:

using (var 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");
}