Domino Code Fragment

Code Name*
Accessing session properties
Date*
04/28/2024
Source (or email address if you prefer)*
Rlatulippe@romac.com
IP address:.3.144.42.196
Description*
This agent uses the Session properties.
Type*
Java
Categories*
(Misc)
Implementation:
Required Client:
Server:
Limitations:
Comments:
Files/Graphics attachments (if applicable): Code:
import java.util.*;
import lotus.notes.*;


public class sessionpropsagent extends AgentBase
{
 public void NotesMain()
   {
   try
     {
       Session s = getSession();
       System.out.println("User name = " +
       (String)s.getUserName());
       Name no = s.getUserNameObject();
       if (no.isHierarchical())
         System.out.println("Common name = " +
         (String)s.getCommonUserName());
       if (s.isOnServer())
         System.out.println("Effective user name = " +
         (String)s.getAgentContext().getEffectiveUserName());
       System.out.println("Notes " +
       (String)s.getNotesVersion() + " running on " +
       (String)s.getPlatform());
       System.out.println("Time zone increment = " +
       (int)s.getInternational().getTimeZone());
       System.out.println("***Address books***");
       Database db;
       Vector books = s.getAddressBooks();
       Enumeration e = books.elements();
       while (e.hasMoreElements()) {
         db = (Database)e.nextElement();
         String fn = db.getFileName();
         String server;
         if (db.getServer() != null)
           server = db.getServer();
         else
           server = "Local";
         String title = db.getTitle();
         System.out.println
         (server + " " + fn + " \"" + title + "\"");
       }
     }
   catch (Exception e)
     {
       e.printStackTrace();
     }
   }
}