Examples: UserNameList property (Session - Java)

This agent prints the common names for the current user checking to make sure the alternate name exists.

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) 
      System.out.println("User name:");
      Vector ulist = session.getUserNameList();
      Name primary = (Name)ulist.firstElement();
      System.out.println("\t" + primary.getCommon());
      if (ulist.size() > 1) {
        Name secondary = (Name)ulist.lastElement();
        System.out.println("\t" + secondary.getCommon() + " (alternate)");
      } else {
        System.out.println("\tNo alternate name");
      }

    } catch(Exception e) {
      e.printStackTrace();
    }
  }
}