Reading and Converting Outlook Files

Working with OST Files

Aspose.Email for .NET provides an API for reading Microsoft Outlook OST files. You can load an OST file from a disk or a stream into an instance of the Aspose.Email.Outlook.Pst.PersonalStorage class to access its contents, such as folders, subfolders, and messages. Microsoft Outlook creates a PST file to store emails when using POP3 or IMAP mail servers. In contrast, it creates an OST file when Microsoft Exchange is the mail server.

Read OST Files

The process for reading an OST file with Aspose.Email is exactly the same as for reading a PST file. The same code can read both PST and OST files: just provide the correct file name to the PersonalStorage.FromFile() method. The following code snippet shows you how to read OST files.

PersonalStorage personalStorage = PersonalStorage.FromFile(dataDir + "PersonalStorageFile.ost");
            
// Get the format of the file
Console.WriteLine("File Format of OST: " + personalStorage.Format);

Convert OST to PST

Aspose.Email makes it possible to convert an OST file to PST with a single line of code. Similarly, the OST file can be created from PST file using the same line of code with the FileFormat enumerator. At present, the API supports converting OST formats to PST except 2013/2016/2019/2021 and future versions. The following code snippet shows you how to Convert OST to PST.

using (PersonalStorage personalStorage = PersonalStorage.FromFile(dataDir + "PersonalStorageFile.ost"))
{
    personalStorage.SaveAs(dataDir + "test.pst", FileFormat.Pst);
}

For performing other operations with OST files, please refer to the following pages:

Convert PST to OST

Conversion from PST to OST is not supported by Aspose.Email because OST is always created by the Outlook when adding an account and synchronizing with the mail server. The difference between PST and OST files is that PST is only available locally. OST content is also available on the e-mail server. So there is no need to convert PST to OST for local use. But you can import PST into an existing account using the Import/Export wizard in Outlook.

Working with OLM Files

OLM is a specific file format used by Microsoft Outlook for Mac to store local data such as emails, attachments, notes, calendar data, contacts, tasks, and history. OLM files are only compatible with Outlook for Mac and cannot be opened or accessed by Outlook for Windows, which uses the PST file format instead.

Aspose.Email provides a dedicated API for reading and converting OLM files. For a complete guide, refer to the Working with OLM Files section, which covers: