Examples: addServerToAddressBook method

This agent adds a record for server2.id to the Domino® Directory on AceOne.

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();
      reg.setRegistrationServer("AceOne");
      reg.setStoreIDInAddressBook(true);
      if (reg.addServerToAddressBook(
        "d:\\NotesAdministrator\\server2.id", // ID file
        "AceTwo/AceHardwareNE/AceHardwareCertifier", // full name
        "AceHardware", // server domain
        "AceHardware", // server password
        "", // network
        "Roberta Person", // administrator
        "Ace Two", // title field
        "", // location field
        "")) // comment field
        { System.out.println("Add server succeeded"); }
        else { System.out.println("Add server failed"); }

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