Examples: remove method (Document - Java)

This agent removes all the documents in a folder.

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("Folder1");
      String subject;
      Document doc = view.getFirstDocument();
      while (doc != null) {
        subject = doc.getItemValueString("Subject");
        doc.remove(true);
        System.out.println("\"" + subject + "\" removed");
        doc = view.getFirstDocument(); }
    } catch(Exception e) {
      e.printStackTrace();
    }
  }
}