Aspose.Email.Examples.CSharp.Email.Outlook.AddMapiNoteToPST.Run C# (CSharp) 메소드

Run() 공개 정적인 메소드

public static Run ( ) : void
리턴 void
        public static void Run()
        {
            // ExStart:AddMapiNoteToPST
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_Outlook();

            MapiMessage mess = MapiMessage.FromFile(dataDir + "Note.msg");

            // Create three Notes  
            MapiNote note1 = (MapiNote)mess.ToMapiMessageItem();
            note1.Subject = "Yellow color note";
            note1.Body = "This is a yellow color note";

            MapiNote note2 = (MapiNote)mess.ToMapiMessageItem();
            note2.Subject = "Pink color note";
            note2.Body = "This is a pink color note";
            note2.Color = NoteColor.Pink;

            MapiNote note3 = (MapiNote)mess.ToMapiMessageItem();
            note2.Subject = "Blue color note";
            note2.Body = "This is a blue color note";
            note2.Color = NoteColor.Blue;
            note3.Height = 500;
            note3.Width = 500;

            string path = dataDir + "AddMapiNoteToPST_out.pst";

            if (File.Exists(path))
            {
                File.Delete(path);
            }

            using (PersonalStorage personalStorage = PersonalStorage.Create(dataDir + "AddMapiNoteToPST_out.pst", FileFormatVersion.Unicode))
            {
                FolderInfo notesFolder = personalStorage.CreatePredefinedFolder("Notes", StandardIpmFolder.Notes);
                notesFolder.AddMapiMessageItem(note1);
                notesFolder.AddMapiMessageItem(note2);
                notesFolder.AddMapiMessageItem(note3);
            }
            // ExEnd:AddMapiNoteToPST
        }
    }
AddMapiNoteToPST