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

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

public static Run ( ) : void
Результат void
        public static void Run()
        {
            // ExStart:SaveMessagesDirectlyFromPSTToStream
            // The path to the file directory.
            string dataDir = RunExamples.GetDataDir_Outlook();

            // Load the Outlook file
            string path = dataDir + "PersonalStorage.pst";

            // Save message to file
            using ( PersonalStorage personalStorage = PersonalStorage.FromFile(path))
            {
                FolderInfo inbox = personalStorage.RootFolder.GetSubFolder("Inbox");
                foreach (MessageInfo messageInfo in inbox.EnumerateMessages())
                {
                    using (FileStream fs = File.OpenWrite(messageInfo.Subject + ".msg"))
                    {
                        personalStorage.SaveMessageToStream(messageInfo.EntryIdString, fs);
                    }
                }
            }
            // ExEnd:SaveMessagesDirectlyFromPSTToStream
        }
    }
SaveMessagesDirectlyFromPSTToStream