例: addUserToAddressBook method

次のエージェントは、AceOne 上の Domino ディレクトリに jyip.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.addUserToAddressBook(
        "d:¥¥NotesAdministrator¥¥jyip.id", // ID file
        "Jimmy Yip/AceHardwareCertifier", // full name
        "Yip", // last name
        "AceHardware", // user password
        "Jimmy", // first name
        "", // middle initial
        "CN=Mail_AceOne/O=AceHardware", // mail server
        "mail¥¥jyip.nsf", // mail file
        "", // forwarding address
        "", // location field
        "")) // comment field
        { System.out.println("Add ID succeeded"); }
        else { System.out.println("Add ID failed"); }

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