创建、保存和读取 Outlook 便笺

本文介绍了独立的 Outlook MapiNote 项目以 MSG 保存。要在 PST 中存储和读取笔记,请参见 在 PST 文件中管理任务、日志和笔记.

创建并保存 Outlook 笔记

Aspose.Email 提供创建 Outlook 便笺并以 MSG 格式保存到磁盘的功能。 MapiNote 类提供属性和方法用于设置笔记信息。本文展示了如何创建、保存和读取一个 MapiNote 从磁盘中。

以下步骤可用于在磁盘上创建并保存便笺:

  1. 实例化该类的对象 MapiNote 类。
  2. 设置各种属性。
  3. 将便笺保存为 MSG 文件到磁盘。

以下代码片段展示了如何创建并保存 Outlook 便笺。

// The path to the File directory.
string dataDir = RunExamples.GetDataDir_Outlook();
// Create MapiNote and set Properties 
MapiNote note3 = new MapiNote();
note3.Subject = "Blue color note";
note3.Body = "This is a blue color note";
note3.Color = NoteColor.Blue;
note3.Height = 500;
note3.Width = 500;
note3.Save(dataDir + "MapiNote_out.msg", NoteSaveFormat.Msg);

读取 MAPI 便笺

MapiNote 类对象用于将 MapiMessage 用于从磁盘加载 MSG 格式便笺的对象。以下代码片段展示了如何读取一个 MapiNote.

// The path to the File directory.
string dataDir = RunExamples.GetDataDir_Outlook();
MapiMessage note = MapiMessage.FromFile(dataDir + "MapiNote.msg");
MapiNote note2 = (MapiNote)note.ToMapiMessageItem();

另见