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

Run() public static method

public static Run ( ) : void
return void
        public static void Run()
        {
            // ExStart:LoadMSGFiles
            // The path to the File directory.
            string dataDir = RunExamples.GetDataDir_Outlook();

            // Create an instance of MapiMessage from file
            MapiMessage msg = MapiMessage.FromFile(dataDir + @"message.msg");

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

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

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

            // Get recipients information
            Console.WriteLine("Recipient: " + msg.Recipients);

            // Get attachments
            foreach (MapiAttachment att in msg.Attachments)
            {
                Console.Write("Attachment Name: " + att.FileName);
                Console.Write("Attachment Display Name: " + att.DisplayName);
            }
            // ExEnd:LoadMSGFiles
        }
    }
LoadMSGFiles