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();
DocumentCollection dc = db.getAllDocuments();
Document doc = dc.getFirstDocument();
while (doc != null) {
Item subject = doc.getFirstItem("Subject");
if (subject == null)
System.out.println("[ No subject ]");
else
System.out.println("[ " +
subject.getText() + " ]");
RichTextItem body =
(RichTextItem)doc.getFirstItem("Body");
if (body == null)
System.out.println("No body");
else
System.out.println(
body.getFormattedText(true, 0, 0));
doc = dc.getNextDocument(); }
} catch(Exception e) {
e.printStackTrace();
}
}
}
import lotus.domino.*;
public class JavaAgent extends AgentBase {
public void NotesMain() {
try {
Session session = getSession();
AgentContext agentContext = session.getAgentContext();
// (Your code goes here)
DocumentCollection dc = agentContext.getUnprocessedDocuments();
Document doc = dc.getFirstDocument();
Item item = doc.getFirstItem("FooBar");
while(item != null) {
System.out.println(item.getName() + ": " + item.getText());
item.remove();
item = doc.getFirstItem("FooBar");
}
} catch(Exception e) {
e.printStackTrace();
}
}
}