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

Run() public static method

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

            string[] attachFileNames = new string[] { dataDir + "Desert.jpg", dataDir + "download.png" };

            MapiJournal journal = new MapiJournal("testJournal", "This is a test journal", "Phone call", "Phone call");
            journal.StartTime = DateTime.Now;
            journal.EndTime = journal.StartTime.AddHours(1);
            journal.Companies = new string[] { "company 1", "company 2", "company 3" };

            foreach (string attach in attachFileNames)
            {
                journal.Attachments.Add(attach,File.ReadAllBytes(attach));
            }
            journal.Save(dataDir + "AddAttachmentsToMapiJournal_out.msg");
            // ExEnd:AddAttachmentsToMapiJournal
        }
    }
AddAttachmentsToMapiJournal