Aspose.Email.Examples.CSharp.Email.Outlook.LoadingFromStream.Run C# (CSharp) Method

Run() public static method

public static Run ( ) : void
return void
        public static void Run()
        {
            // The path to the File directory.
            string dataDir = RunExamples.GetDataDir_Outlook();
            string dst = dataDir + "PersonalStorage.pst";

            // Create an instance of MapiMessage from file
            byte[] bytes = File.ReadAllBytes(dataDir + @"message.msg");

            using (MemoryStream stream = new MemoryStream(bytes))
            {
                stream.Seek(0, SeekOrigin.Begin);
                // Create an instance of MapiMessage from file
                MapiMessage msg = MapiMessage.FromStream(stream);

                // Get subject
                Console.WriteLine("Subject:" + msg.Subject);

                // Get from address
                Console.WriteLine("From:" + msg.SenderEmailAddress);

                // Get body
                Console.WriteLine("Body" + msg.Body);

            }
        }
    }
LoadingFromStream