Examples: switchToID method

This agent switches to user.id.

import lotus.domino.*;

public class JavaAgent extends AgentBase {

  public void NotesMain() {

    try {
      Session session = getSession();
      AgentContext agentContext = session.getAgentContext();

      // (Your code goes here) 
      Registration reg = session.createRegistration();
      String un = reg.switchToID("d:\\NotesAdministrator\\user.id",
        "AceHardware");
      if (un.equals(""))
        System.out.println("File does not exist or not a user ID");
      else
        System.out.println("User name = " + un);

    } catch(NotesException e) {
      System.out.println(e.id + " " + e.text);
      e.printStackTrace();
    }
  }
}