Examples: formatMsgWithDoclinks method; IsDoScore, IsDoSubject, and SubjectItemName properties
This agent makes a document collection of all documents in the current database containing the word "arachnid," then makes a newsletter based on this document collection. The agent formats a message with links to the newsletter documents and mails it to the current user.
import lotus.domino.*;
public class JavaAgent extends AgentBase {
public void NotesMain() {
try {
Session session = getSession();
AgentContext agentContext = session.getAgentContext();
// (Your code goes here)
Database db = agentContext.getCurrentDatabase();
db.updateFTIndex(true);
DocumentCollection dc = db.FTSearch("arachnid", 0);
if (dc.getCount() > 0) {
Newsletter news = session.createNewsletter(dc);
news.setSubjectItemName("Subject");
news.setDoSubject(true);
news.setDoScore(true);
Document doc = news.formatMsgWithDoclinks(db);
doc.appendItemValue("Form", "Memo");
doc.appendItemValue("Subject", "The Arachnid Report");
doc.send(false, session.getUserName()); }
} catch(Exception e) {
e.printStackTrace();
}
}
}