public static void Run()
{
// ExStart:MergePSTFiles
// 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 separate folder.
personalStorage.MergeWith(Directory.GetFiles(dataDir + @"MergePST\"));
Console.WriteLine("Total messages added: {0}", totalAdded);
}
// ExEnd:MergePSTFiles
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.");
}
}