Examples: getDocumentByKey method
- This agent gets the first document in the first category that
begins with "Spanish" 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"); Document doc = view.getDocumentByKey("Spanish leather", false); if (doc != null) doc.putInFolder("Boots"); } catch(Exception e) { e.printStackTrace(); } } }
- This agent gets the first document in the category "Boots" in
the subcategory "Spanish leather" in the By Category view of the current
database.
import lotus.domino.*; import java.util.Vector; 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"); Vector v = new Vector(); v.addElement("Boots"); v.addElement("Spanish leather"); Document doc = view.getDocumentByKey(v, false); doc.putInFolder("Boots"); } catch(Exception e) { e.printStackTrace(); } } }