Outlook MSG ファイルのフォローアップと期限日の操作

Outlook MSG ファイルのフォローアップと期限日の設定

フォローアップフラグは、メールメッセージに何らかのアクションを示すマークです。Microsoft Outlook はユーザーがメッセージにフラグを付け、フラグ設定でフォローアップの期限日を割り当てることができます。Microsoft Outlook は受信者にリマインダーを送信し、メールのフォローアップを促します。メールにフラグを付け、期限日をプログラムで設定することで、ソフトウェア開発者は特定の種類のメールを自動化し、受信者がアクションを取ることを忘れないように支援できます。例えば、営業チームに毎月メッセージを送信してレポートの作成を促したり、全スタッフに会社の会議を知らせるメッセージを送信したりする際に利用できます。Aspose.Email for Java はフォローアップフラグと期限日の設定をサポートしています。 MapiMessage オブジェクトを使用して FollowUpManager および FollowUpOptions. メッセージにフォローアップフラグを設定できるバリエーションは多数あります。以下のコードサンプルですべて使用されています。

  1. メッセージのフォローアップフラグを設定する
  2. メッセージに期限日とリマインダー日を追加する
  3. 受信者のメッセージにフラグを追加します。
  4. 完了としてマークする。
  5. フラグを削除します。
  6. フォローアップ オプションを読む。

フォローアップ フラグの設定

以下のコードスニペットは、フォローアップ フラグを設定する方法を示します。

// For complete examples and data files, please go to https://github.com/aspose-email/Aspose.Email-for-Java
// The path to the File directory.
String dataDir = "outlook/";

MailMessage mailMsg = new MailMessage();
mailMsg.setSender(new MailAddress("AETest12@gmail.com"));
mailMsg.getTo().addMailAddress(new MailAddress("receiver@gmail.com"));
mailMsg.setBody("This message will test if follow up options can be added to a new mapi message.");
MapiMessage mapi = MapiMessage.fromMailMessage(mailMsg);

Calendar calendar = Calendar.getInstance();
calendar.set(2013, Calendar.MAY, 23, 14, 40, 0);
Date dtStartDate = calendar.getTime();

calendar.set(2013, Calendar.MAY, 23, 16, 40, 0);
Date dtReminderDate = calendar.getTime();

calendar.add(Calendar.DATE, 1);
Date dtDueDate = calendar.getTime();

FollowUpOptions options = new FollowUpOptions("Follow Up", dtStartDate, dtDueDate, dtReminderDate);
FollowUpManager.setOptions(mapi, options);
mapi.save(dataDir + "SetFollowUpflag_out.msg");

受信者向けフォローアップの設定

以下のコードスニペットは、受信者に対してフォローアップを設定する方法を示します。

// For complete examples and data files, please go to https://github.com/aspose-email/Aspose.Email-for-Java
// The path to the File directory.
String dataDir = "outlook/";

MailMessage mailMsg = new MailMessage();
mailMsg.setSender(new MailAddress("AETest12@gmail.com"));
mailMsg.getTo().addMailAddress(new MailAddress("receiver@gmail.com"));
mailMsg.setBody("This message will test if follow up options can be added to a new mapi message.");

MapiMessage mapi = MapiMessage.fromMailMessage(mailMsg);
mapi.setMessageFlags(MapiMessageFlags.MSGFLAG_UNSENT); // mark this message as draft

Calendar calendar = Calendar.getInstance();
calendar.set(2013, Calendar.MAY, 23, 16, 40, 0);
Date dtReminderDate = calendar.getTime();

// Add the follow up flag for recipient now
FollowUpManager.setFlagForRecipients(mapi, "Follow up", dtReminderDate);
mapi.save(dataDir + "SetFollowUpForRecipients_out.msg");

フォローアップ フラグを完了としてマーク

以下のコードスニペットは、フォローアップ フラグを完了としてマークする方法を示します。

// For complete examples and data files, please go to https://github.com/aspose-email/Aspose.Email-for-Java
// The path to the File directory.
String dataDir = "outlook/";

MapiMessage mapi = MapiMessage.fromFile(dataDir + "message.msg");
FollowUpManager.markAsCompleted(mapi);
mapi.save(dataDir + "MarkedCompleted_out.msg");

フォローアップ フラグの削除

以下のコードスニペットは、フォローアップ フラグを削除する方法を示します。

// For complete examples and data files, please go to https://github.com/aspose-email/Aspose.Email-for-Java
// The path to the File directory.
String dataDir = "outlook/";

MapiMessage mapi = MapiMessage.fromFile(dataDir + "message.msg");
FollowUpManager.clearFlag(mapi);
mapi.save(dataDir + "FollowUpFlagRemoved_out.msg");

メッセージのフォローアップ フラグ オプションを読む

以下のコードスニペットは、メッセージのフォローアップ フラグ オプションを読み取る方法を示します。

// For complete examples and data files, please go to https://github.com/aspose-email/Aspose.Email-for-Java
// The path to the File directory.
String dataDir = "outlook/";

MapiMessage mapi = MapiMessage.fromFile(dataDir + "message.msg");
FollowUpOptions options = FollowUpManager.getOptions(mapi);