Examples: AllDocuments property

This agent gets the number of documents in the current database, then gets the value of the Subject item for each document.

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();
      String title = db.getTitle();
      DocumentCollection dc = db.getAllDocuments();
      System.out.println("Database \"" +
      title + "\" has " + dc.getCount() + " documents");
      int n = 0;
      Document doc = dc.getFirstDocument();
      while (doc != null) {
        n++;
        System.out.println
        ("Document # " + n + ": " +
        doc.getItemValueString("Subject"));
        doc = dc.getNextDocument();
       }
    } catch(Exception e) {
      e.printStackTrace();
    }
  }
}