Examples: addUserToAddressBook method

This agent adds a record for jyip.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.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();
    }
  }
}