Examples: updateProcessedDoc method
This program is for an agent that runs on newly created and modified documents since the last run. The program gets the unprocessed documents, prints each Subject item, and marks each document as processed. The first time the agent runs, getUnprocessedDocuments returns all of the documents in the database. Thereafter, getUnprocessedDocuments returns those documents that updateProcessedDoc has not touched.
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();
while (doc != null) {
System.out.println(
doc.getItemValueString("Subject"));
agentContext.updateProcessedDoc(doc);
doc = dc.getNextDocument();
}
} catch(Exception e) {
e.printStackTrace();
}
}
}