- This agent finds the "By Category" view in a database and gets
the first document in the view.
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 = session.getDatabase
("FrenchFry", "NotesUA\\progwork");
View view = db.getView("By Category");
view.setAutoUpdate(false);
Document doc = view.getFirstDocument();
System.out.println
(doc.getItemValueString("Subject"));
} catch(Exception e) {
e.printStackTrace();
}
}
}
- This agent finds the "($All)" hidden view in a database and gets
the first document in the view.
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 = session.getDatabase
("FrenchFry", "NotesUA\\progwork");
View view = db.getView("($All)");");
view.setAutoUpdate(false);
Document doc = view.getFirstDocument();
System.out.println
(doc.getItemValueString("Subject"));
} catch(Exception e) {
e.printStackTrace();
}
}
}
- This agent finds the default view in a 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 = session.getDatabase
("FrenchFry", "NotesUA\\progwork");
Vector views = db.getViews();
View view = null;
for (int i=0; i<views.size(); i++) {
view = (View)views.elementAt(i);
if (view.isDefaultView()) break; }
System.out.println
(view.getName() + " is the default view");
} catch(Exception e) {
e.printStackTrace();
}
}
}