Aspose.Email.Examples.CSharp.Email.Outlook.AddMessagesFromOtherPST.BulkAddFromAnotherPst C# (CSharp) Метод

BulkAddFromAnotherPst() приватный статический Метод

private static BulkAddFromAnotherPst ( string source ) : void
source string
Результат void
        private static void BulkAddFromAnotherPst(string source)
        {
            using (PersonalStorage pst = PersonalStorage.FromFile(source, false))
            using (PersonalStorage pstDest = PersonalStorage.FromFile(RunExamples.GetDataDir_Outlook() + "PersonalStorageFile1.pst"))
            {
                // Get the folder by name
                FolderInfo folderInfo = pst.RootFolder.GetSubFolder("Contacts");
                MessageInfoCollection ms = folderInfo.GetContents();

                // Get the folder by name
                FolderInfo f = pstDest.RootFolder.GetSubFolder("myInbox");
                f.MessageAdded += new MessageAddedEventHandler(OnMessageAdded);
                f.AddMessages(folderInfo.EnumerateMapiMessages());
                FolderInfo fi = pstDest.RootFolder.GetSubFolder("myInbox");
                MessageInfoCollection msgs = fi.GetContents();

            }

        }