Examples: markAllRead method (View - Java)

This agent displays number of unread documents in the view before and after marking them all read.

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("All");
      ViewEntryCollection vec = view.getAllUnreadDocuments();
      System.out.println("View has " +
      vec.getCount() + " unread entries");     
      view.markAllRead();
      view.refresh();
      vec = view.getAllUnreadDocuments();
      System.out.println("View has " +
      vec.getCount() + " unread entries after markAllRead");    


    } catch(Exception e) {
      e.printStackTrace();
    }
  }
}