管理 Outlook 笔记
Contents
[
Hide
]
创建并保存 Outlook 笔记
Aspose.Email 提供创建 Outlook 笔记并以 MSG 格式保存到磁盘的功能。该 MapiNote 类包含用于配置笔记详细信息的属性和方法。以下代码示例演示如何创建并保存 MapiNote 到磁盘。
- 通过创建实例来初始化 MapiNote 对象 MapiNote 类。
- 设置笔记属性: 主题、正文、颜色和尺寸。
- 将笔记以 MSG 格式保存到磁盘,指定文件路径。
import aspose.email as ae
note = ae.mapi.MapiNote()
note.subject = "Blue color note"
note.body = "This is a blue color note"
note.color = ae.mapi.NoteColor.BLUE
note.height = 500
note.width = 500
note.save(data_dir + "CreateAndSaveOutlookNote_out.msg", ae.mapi.NoteSaveFormat.MSG)
读取 MapiNote 文件
以 MSG 格式从磁盘加载的笔记由一个 MapiMessage 对象。将返回的项强制转换为其 to_mapi_message_item() 方法用于 MapiNote 访问笔记特定属性。下面的代码片段演示了如何读取 MapiNote:
import aspose.pycore as pycore
from aspose.email.mapi import MapiMessage, MapiNote
message = MapiMessage.load(data_dir + "note.msg")
note = pycore.cast(MapiNote, message.to_mapi_message_item())
print("Subject:", note.subject)
print("Color:", note.color)
print("Height x Width:", note.height, "x", note.width)