例: addServerToAddressBook method

次のエージェントは、AceOne 上の Domino ディレクトリに server2.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();
      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();
    }
  }
}