Examples: appendToTextList method

  1. This agent appends to two String values to a text list.
    import lotus.domino.*;
    public class JavaAgent extends AgentBase {
      public void NotesMain() {
        try {
          Session session = getSession();
          AgentContext agentContext = 
          session.getAgentContext();
          // (Your code goes here) 
          Database db = agentContext.getCurrentDatabase();
          DocumentCollection dc = db.getAllDocuments();
          Document doc = dc.getFirstDocument();
          if (doc != null) {
            Item item = doc.getFirstItem("textListItem");
            item.appendToTextList("Motorcycle");
            item.appendToTextList("Airplane");
            doc.save();
            }
        } catch(Exception e) {
          e.printStackTrace();
        }
      }
    }
  2. This agent appends a Vector of two String values to a text item
    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) 
          Database db = agentContext.getCurrentDatabase();
          DocumentCollection dc = db.getAllDocuments();
          Document doc = dc.getFirstDocument();
          if (doc != null) {
            Item item = doc.getFirstItem("textListItem");
            Vector v = new Vector();
            v.addElement("Motorcycle");
            v.addElement("Airplane");
            item.appendToTextList(v);
            doc.save();
            }
        } catch(Exception e) {
          e.printStackTrace();
        }
      }
    }