PST Viewer for .NET Applications
View PST files programmatically in C# without Microsoft Outlook or Thunderbird dependencies.
How to View PST Files Using an Advanced Email API
Simplify the process of viewing PST files programmatically in your .NET applications with Aspose.Email for .NET . The API is designed to make working with storage files efficient and intuitive. With features like folder traversal, message extraction, and HTML rendering, you can easily create a user-friendly PST file viewing experience.
The C# email API provides a high-performance, standalone solution to handle storage file viewing tasks, making it ideal for applications like email clients, archiving systems, and custom email viewers.
Key Features for Viewing PST Files
Traverse PST folders and extract messages programmatically.
Support for .NET Framework, .NET Core, and .NET Standard.
Independence from Microsoft Outlook or other third-party software.
HTML rendering of email messages for integration into web or desktop applications.
The library ensures precision and ease of use, enabling developers to programmatically access the content of PST files, including emails, attachments, and metadata.
PST files are loaded into a structured format which makes it easy to work with email content programmatically. Each email is represented as a MapiMessage object, allowing you to extract details such as the sender, recipients, subject, and body. Using the API, you can render these messages as HTML files, enabling seamless viewing in a web browser or embedding them into your application’s user interface.
In addition to the email content, the library ensures that attachments and embedded resources are preserved. These can be accessed or displayed alongside the message for a comprehensive viewing experience.
C# Email API Installation and Use to View PST Files
To begin, install the API in your development environment:
Open NuGet package manager, search for Aspose.Email and click Install.
You may also use the following command in the Package Manager Console.
Command
PM> Install-Package Aspose.Email
Once installed, you can start coding.
Steps to View PST via C#
Aspose.Email makes it easy for the developers to view the PST file with just few lines of code.
- Open the file using the PersonalStorage.FromFile method.
- Create the output directory if it does not exist.
- Access the Inbox folder from the file using RootFolder.GetSubFolder(“Inbox”) .
- Loop through each message in the Inbox using inbox.EnumerateMapiMessages() .
- Configure HtmlSaveOptions to save resources (e.g., images) as separate files and use relative paths.
- Save each message as an HTML file constructing file names (Message1.html, Message2.html, etc.), and saving each message to the output directory.
System Requirements
Aspose.Email for .NET is supported on all major operating systems. Just make sure that you have the following prerequisites.
- Microsoft Windows or a compatible OS with .NET Framework, .NET Core, and Xamarin Platforms
- Development environment like Microsoft Visual Studio
- Aspose.Email referenced in your project
C# code to view PST
using (var pst = PersonalStorage.FromFile("storage.pst"))
{
// Ensure the output directory exists
Directory.CreateDirectory(outputDirectory);
var inbox = pst.RootFolder.GetSubFolder("Inbox");
// Iterate through PST messages and save them as .html files
int count = 1;
foreach (var msg in inbox.EnumerateMapiMessages())
{
// Save each message as .html file
var htmlFilePath = Path.Combine(outputDirectory, $"Message{count}.html");
var htmlSaveOptions = new HtmlSaveOptions
{
ResourceRenderingMode = ResourceRenderingMode.SaveToFile,
UseRelativePathToResources = true
};
msg.Save(htmlFilePath, htmlSaveOptions);
}
}
View PST in a Browser
In the following image, you can see how email content of a PST file is displayed in a browser after being converted to an HTML format using the API. Each email is rendered with its subject, sender, recipients, and body content, ensuring a seamless viewing experience. This approach eliminates the need for external email clients, providing a lightweight and efficient PST viewer for your applications.

About the C# API
Aspose.Email is a Microsoft Outlook and Thunderbird formats parsing solution. One can easily create, manipulate, convert email and storage formats such as MSG, EMLX, EML and MHT. Handling of email attachments, customization of message headers and implementation of different network protocols like POP3, IMAP & SMTP to send & receive emails is much easier. Its a standalone API and does not require Microsoft Outlook or any other software installation.
Try Aspose.Email for Free
Discover the full potential of the library with a free trial version. Visit the download page to explore its features and integrate powerful email functionality into your projects today.
PST Viewer Online
Email File Viewer for Other Formats
Aspose.Email for .NET extends its functionality beyond PST files, supporting a variety of email formats. Developers can also use it to view the following: