PNG JPG BMP TIFF PST
Aspose.Email  for .NET

How to Merge PST Files in C#

Intuitive and high-performance .NET API to merge Outlook PST files, without Microsoft Outlook software dependency.

The process of merging PST files lies in combining multiple PST files into a single file, which can help in organizing and consolidating Outlook data for easier management and access. This can also help in simplifying data backup and archival processes.

Your comprehensive solution in this task is Aspose.Email for .NET. With this powerful C# API, managing and consolidating Outlook data has never been simpler. The API provides a robust set of features to seamlessly merge PST files, allowing you to streamline your email management process. Its methods for opening, reading, and manipulating PST files make the task easy and precise.

Aspose.Email for .NET also supports event subscription for tracking the merging process, providing the flexibility to monitor and handle the merging operations. Additionally, the API offers advanced features for handling any errors or exceptions that may arise during the merging process, ensuring a smooth and reliable operation.

The C# API is easy to install and utilize. Start optimizing your Outlook data management with Aspose.Email for .NET by performing one of the following actions:

  • Open NuGet package manager, search for Aspose.Email and install it on your device.

  • Use the following command from the Package Manager Console:


PM> Install-Package Aspose.Email

Steps for Merging PST Files in C#

A basic file merging and concatenating with Aspose.Email for .NET APIs can be done with just few lines of code.

  1. Use PersonalStorage.FromFile to access the PST file.
  2. Subscribe to the events for tracking process.
  3. Merge PST files located in a separate folder using personalStorage.MergeWith() method.

System Requirements

Our APIs are supported on all major platforms and Operating Systems. Before executing the code below, please make sure that you have the following prerequisites on your system.

  • Microsoft Windows or a compatible OS with .NET Framework, .NET Core, Windows Azure, Mono or Xamarin Platforms
  • Development environment like Microsoft Visual Studio
  • Aspose.Email for .NET DLL referenced in your project - Install from NuGet using the Download button above
 

Merge PST Files - C#

// The path to the File directory.
string dataDir = RunExamples.GetDataDir_Outlook();
string dst = dataDir + "Sub.pst";
totalAdded = 0;
try
{
    using (PersonalStorage personalStorage = PersonalStorage.FromFile(dst))
    {
        // The events subscription is an optional step for the tracking process only.
        personalStorage.StorageProcessed += PstMerge_OnStorageProcessed;
        personalStorage.ItemMoved += PstMerge_OnItemMoved;

        // Merges with the pst files that are located in a separate folder. 
        personalStorage.MergeWith(Directory.GetFiles(dataDir + @"MergePST\"));
        Console.WriteLine("Total messages added: {0}", totalAdded);
    }                
    Console.WriteLine(Environment.NewLine + "PST merged successfully at " + dst);
}
catch (Exception ex)
{
    Console.WriteLine(ex.Message + "\nThis example will only work if you apply a valid Aspose Email License. You can purchase full license or get 30 day temporary license from http:// Www.aspose.com/purchase/default.aspx.");
}
 

Maximize System Productivity: Combine PST Files with the Advanced C# API

By leveraging the advanced features of the C# API, you can seamlessly consolidate multiple PST files into a single file, achieving a more efficient and organized data structure for enhanced productivity. Here are key benefits:

  1. Efficient data management: Consolidating multiple PST files into a single file makes it easier to manage and locate emails, contacts, and other information, streamlining data access and organization.

  2. Reduced risk of data loss: Merging PST files reduces the risk of accidentally misplacing or losing important data, especially during backup and migration processes, as all data is consolidated in a single file.

  3. Optimal use of storage space: By merging PST files, redundant or duplicated data across different files can be minimized, leading to more efficient storage space utilization on your system or mail server.

  4. Simplified backup and archival processes: Managing backups and archives for a single, consolidated PST file is simpler and less time-consuming compared to dealing with multiple files.

  5. Enhanced performance and synchronization: Merging PST files can improve Outlook performance and minimize synchronization issues, especially when dealing with a large volume of data, as all data is stored in a unified file.

API Short Overview

Aspose.Email for .NET is a Microsoft Outlook and Thunderbird files parsing solution. One can easily create, manipulate, convert email and storage formats such as EML, EMLX, HTML, MHT, MSG, PST, MBOX, etc. 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.

Aspose.Email provides free access to its resources:

  • a comprehensible documentation with thorough instructions on all supported features
  • support forum providing professional answers to all possible questions
  • the blog with a collection of posts on urgent issues
  • advanced features of the library

The API is standalone and does not require Microsoft Outlook or any other software installation.

  • PST What is PST File Format

    Files with .PST extension represent Outlook Personal Storage Files (also called Personal Storage Table) that store variety of user information. User information is stored in folders of different types that include emails, calendar items, notes, contacts, and several other file formats. PST files are used for archiving emailing data offline that can be later loaded and viewed in various applications.

    Read More