Examples: getFirstDocument method

This agent gets the first document in the By Category view of the current database.

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();
      View view = db.getView("By Category");
      System.out.println
      ("***By Category view - first document***");
      Document doc = view.getFirstDocument();
      System.out.println
      ("\t" + doc.getItemValueString("Subject"));
    } catch(Exception e) {
      e.printStackTrace();
    }
  }
}