Domino Code Fragment

Code Name*
IsOnServer property
Date*
04/28/2024
Source (or email address if you prefer)*
Rlatulippe@romac.com
IP address:.18.116.40.47
Description*
This agent gets names.nsf from the user's mail server if the program is running on a server, and from the local Notes directory otherwise.
Type*
Java
Categories*
(Misc)
Implementation:
Required Client:
Server:
Limitations:
Comments:
Files/Graphics attachments (if applicable): Code:
import lotus.notes.*;


public class isonserveragent extends AgentBase
{
 public void NotesMain()
   {
   try
     {
       Session s = getSession();
       Database db;
       if (s.isOnServer()) {
         String ms = s.getEnvironmentString("MailServer", true);
         db = s.getDatabase(ms, "names.nsf"); }
       else {
         db = s.getDatabase(null, "names.nsf"); }
       System.out.println("Title of names.nsf: \""
       + db.getTitle() + "\"");
     }
   catch (Exception e)
     {
       e.printStackTrace();
     }
   }
}