PST での MapiNote の操作
Contents
[
Hide
]
PST に MapiNote を追加
新規 PST の作成、サブフォルダーとメッセージの追加 PST ファイルの作成とサブフォルダーの追加方法を示しました。Aspose.Email を使用すると、作成または読み込んだ PST ファイルの Notes サブフォルダーに MapiNote を追加できます。
以下は PST に MapiNote を追加する手順です:
- Microsoft Outlook を使用してテンプレート MapiNote を作成し、MSG ファイルとして保存します。
- 保存された MSG ノートをロードして MapiMessage オブジェクト。
- 作成する MapiNote オブジェクトを使用してテンプレート MSG ノートをロードします。
- 設定します MapiNote さまざまな方法でプロパティを取得します。
- 次を使用して PST を作成します PersonalStorage.create() メソッド。
- ルートフォルダーにアクセスし、次に呼び出すことで、PST ファイルのルートに事前定義されたフォルダー (Notes) を作成します。 addMapiMessageItem() メソッド。
以下のコードスニペットは、次の作成方法を示します MapiNote そしてそれを新しく作成した PST ファイルの Notes フォルダーに追加します。
// For complete examples and data files, please go to https://github.com/aspose-email/Aspose.Email-for-Java
String dataDir = "data/";
MapiMessage source = MapiMessage.load(dataDir + "Note.msg");
// Note #1
MapiNote note1 = (MapiNote) source.toMapiMessageItem();
note1.setSubject("Yellow color note");
note1.setBody("This is a yellow color note");
// Note #2
MapiNote note2 = (MapiNote) source.toMapiMessageItem();
note2.setSubject("Pink color note");
note2.setBody("This is a pink color note");
note2.setColor(NoteColor.Pink);
// Note #3
MapiNote note3 = (MapiNote) source.toMapiMessageItem();
note3.setSubject("Blue color note");
note3.setBody("This is a blue color note");
note3.setColor(NoteColor.Blue);
note3.setHeight(500);
note3.setWidth(500);
PersonalStorage pst = PersonalStorage.create(dataDir + "MapiNoteToPST_out.pst", FileFormatVersion.Unicode);
FolderInfo notesFolder = pst.createPredefinedFolder("Notes", StandardIpmFolder.Notes);
notesFolder.addMapiMessageItem(note1);
notesFolder.addMapiMessageItem(note2);
notesFolder.addMapiMessageItem(note3);