例: getUserInfo method

次のエージェントは、AceOne 上の Domino ディレクトリから Roberta Person のユーザー情報を取得します。

import lotus.domino.*;
import java.util.Vector;

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");
      String username = "Roberta Person";
      StringBuffer mailserver = new StringBuffer();
      StringBuffer mailfile = new StringBuffer();
      StringBuffer maildomain = new StringBuffer();
      StringBuffer mailsystem = new StringBuffer();
      Vector profile = new Vector();
      reg.getUserInfo(username,
        mailserver,
        mailfile,
        maildomain,
        mailsystem,
        profile);
      System.out.println("Info for " + username + "¥n" +
        "¥tMail server:¥t" + mailserver + "¥n" +
        "¥tMail file:¥t¥t" + mailfile + "¥n" +
        "¥tMail domain:¥t" + maildomain + "¥n" +
        "¥tMail system:¥t" + mailsystem + "¥n" +
        "¥tProfile:");
        for (int n=0; n<profile.size(); n++) {
          System.out.println(profile.elementAt(n));
          }

    } catch(Exception e) {
      e.printStackTrace();
    }
  }
}