Aspose.Email.Examples.CSharp.Email.Outlook.MoveItemsToOtherFolders.Run C# (CSharp) Метод

Run() публичный статический Метод

public static Run ( ) : void
Результат void
        public static void Run()
        {
            // The path to the File directory.
            // ExStart:MoveItemsToOtherFolders
            string dataDir = RunExamples.GetDataDir_Outlook();
            using (PersonalStorage personalStorage = PersonalStorage.FromFile(dataDir + "Outlook_1.pst"))
            {
                FolderInfo inbox = personalStorage.GetPredefinedFolder(StandardIpmFolder.Inbox);
                FolderInfo deleted = personalStorage.GetPredefinedFolder(StandardIpmFolder.DeletedItems);
                FolderInfo subfolder = inbox.GetSubFolder("Inbox");

                if (subfolder != null)
                {
                    // Move folder to the Deleted Items
                    personalStorage.MoveItem(subfolder, deleted);

                    // Move message to the Deleted Items
                    MessageInfoCollection contents = subfolder.GetContents();
                    personalStorage.MoveItem(contents[0], deleted);

                    // Move all inbox subfolders to the Deleted Items
                    inbox.MoveSubfolders(deleted);

                    // Move all subfolder contents to the Deleted Items
                    subfolder.MoveContents(deleted);
                }
            }
            // ExEnd:MoveItemsToOtherFolders
        }
    }
MoveItemsToOtherFolders