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

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

public static Run ( ) : void
Результат void
        public static void Run()
        {
            // ExStart:DeleteMessagesFromPSTFiles
            // The path to the File directory.
            string dataDir = RunExamples.GetDataDir_Outlook() + "Sub.pst";

            // Load the Outlook PST file
            PersonalStorage personalStorage = PersonalStorage.FromFile(dataDir);

            // Get the Sent items folder
            FolderInfo folderInfo = personalStorage.GetPredefinedFolder(StandardIpmFolder.SentItems);

            MessageInfoCollection msgInfoColl = folderInfo.GetContents();
            foreach (MessageInfo msgInfo in msgInfoColl)
            {
                Console.WriteLine(msgInfo.Subject + ": " + msgInfo.EntryIdString);
                if (msgInfo.Subject.Equals("some delete condition") == true)
                {
                    // Delete this item
                    folderInfo.DeleteChildItem(msgInfo.EntryId);
                    Console.WriteLine("Deleted this message");
                }
            }
            // ExStart:DeleteMessagesFromPSTFiles
        }
    }
DeleteMessagesFromPSTFiles