Examples: IsOnServer property
This agent gets names.nsf from the user's mail server if the program is running on a server, and from the local Domino® data directory otherwise.
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;
if (session.isOnServer()) {
String ms = session.getEnvironmentString("MailServer",
true);
db = session.getDatabase(ms, "names.nsf"); }
else {
db = session.getDatabase(null, "names.nsf"); }
System.out.println("Title of names.nsf: \""
+ db.getTitle() + "\"");
} catch(Exception e) {
e.printStackTrace();
}
}
}