Работа с MapiNote в PST
Contents
[
Hide
]
Добавление MapiNote в PST
Создание нового PST-файла и добавление подпапок показали, как создать PST-файл и добавить подпапку в него. С помощью Aspose.Email вы можете добавить MapiNote в подпапку Заметки PST-файла, который вы создали или загрузили. Чтобы добавить MapiNote в PST:
- Создайте шаблон MapiNote с помощью Microsoft Outlook и сохраните его в виде MSG-файла.
- Загрузите сохранённую MSG-заметку в объект MapiMessage.
- Создайте объект MapiNote и загрузите шаблон MSG-заметки.
- Установите свойства MapiNote.
- Создайте PST с помощью метода PersonalStorage.Create().
- Создайте предопределённую папку (Заметки) в корне PST-файла, получив доступ к корневой папке и затем вызвав метод AddMapiMessageItem().
Следующий фрагмент кода показывает, как создать MapiNote, а затем добавить его в папку заметок вновь созданного PST-файла.
This file contains 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() |