Examples: Accessing document properties using Java™
This agent prints properties of a document.
import lotus.domino.*;
import java.util.Vector;
import java.util.Enumeration;
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) {
System.out.println("******");
System.out.println(
doc.getItemValueString("Subject"));
Enumeration e = doc.getAuthors().elements();
while (e.hasMoreElements())
System.out.println("Author: " + e.nextElement());
System.out.println("Created: " + doc.getCreated());
if (doc.isNewNote())
System.out.println("Is new note");
if (doc.isResponse())
System.out.println("Parent UNID: " +
doc.getParentDocumentUNID());
if (doc.isSigned()) {
System.out.println("Signed by: " +
doc.getSigner());
System.out.println("Verified by: " +
doc.getVerifier()); }
System.out.println("Last accessed: " +
doc.getLastAccessed());
System.out.println("Verified by: " +
doc.getLastModified());
System.out.println("Note ID: " +
doc.getNoteID());
System.out.println("Universal ID: " +
doc.getUniversalID());
doc = dc.getNextDocument(); }
} catch(Exception e) {
e.printStackTrace();
}
}
}