Working with MapiNote in PST
Contents
[
Hide
]
Adding MapiNote to PST
Create a New PST File and Add Subfolders showed how to create a PST file and add a subfolder to it. With Aspose.Email you can add a MapiNote to the Notes subfolder of a PST file that you have created or loaded. To add a MapiNote to a PST:
- Create a template MapiNote using Microsoft Outlook and save it as an MSG file.
- Load the saved MSG note into a MapiMessage object.
- Create a MapiNote object and load the template MSG note.
- Set the MapiNote properties.
- Create a PST using the PersonalStorage.Create() method.
- Create a pre-defined folder (Notes) at the root of the PST file by accessing the root folder and then calling the AddMapiMessageItem() method.
The following code snippet shows you how to create a MapiNote and then add it to the notes folder of a newly created PST file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
For complete examples and data files, please go to https://github.com/aspose-email/aspose-email-python-dotnet | |
# Create three Notes | |
note1 = MapiNote() | |
note1.subject = "Yellow color note" | |
note1.body = "This is a yellow color note" | |
note2 = MapiNote() | |
note2.subject = "Pink color note" | |
note2.body = "This is a pink color note" | |
note2.color = NoteColor.PINK | |
note3 = MapiNote() | |
note2.subject = "Blue color note"; | |
note2.body = "This is a blue color note"; | |
note2.color = NoteColor.BLUE | |
note3.height = 500 | |
note3.width = 500 | |
personalStorage = PersonalStorage.create(dataDir + "AddMapiNoteToPST_out.pst", FileFormatVersion.UNICODE) | |
notesFolder = personalStorage.create_predefined_folder("Tasks", StandardIpmFolder.NOTES) | |
notesFolder.add_mapi_message_item(note1) | |
notesFolder.add_mapi_message_item(note2) | |
notesFolder.add_mapi_message_item(note3) | |
personalStorage.dispose() |