コード例 #1
0
        public static void Run()
        {
            // The path to the File directory.
            // ExStart:MergePSTFolders
            string dataDir = RunExamples.GetDataDir_Outlook();

            try
            {
                using (PersonalStorage destinationPst = PersonalStorage.FromFile(dataDir + @"destination.pst"))
                    using (PersonalStorage sourcePst = PersonalStorage.FromFile(dataDir + @"source.pst"))
                    {
                        FolderInfo destinationFolder = destinationPst.RootFolder.AddSubFolder("FolderFromAnotherPst");
                        FolderInfo sourceFolder      = sourcePst.GetPredefinedFolder(StandardIpmFolder.DeletedItems);

                        // The events subscription is an optional step for the tracking process only.
                        destinationFolder.ItemMoved += destinationFolder_ItemMoved;

                        // Merges with the folder from another pst.
                        destinationFolder.MergeWith(sourceFolder);
                        Console.WriteLine("Total messages added: {0}", totalAdded);
                    }
            }
            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.");
            }
            // ExEnd:MergePSTFolders
        }