次のエージェントは、ビュー内の全文書に対する返答メッセージを送信します。
import lotus.domino.*;
public class JavaAgent extends AgentBase {
public void NotesMain() {
try {
Session session = getSession();
AgentContext agentContext = session.getAgentContext();
// (Your code goes here)
DbDirectory dir = session.getDbDirectory(null);
Database db = dir.openMailDatabase();
View view = db.getView("Filed but not forgotten");
Document doc = view.getFirstDocument();
while (doc != null) {
Document reply = doc.createReplyMessage(false);
reply.replaceItemValue("Subject",
"Can't work on this now");
reply.replaceItemValue("Body",
"This has been filed for future consideration.");
reply.send(doc.getItemValueString("From"));
doc = view.getNextDocument(doc); }
} catch(NotesException e) {
e.printStackTrace();
}
}
}