Examples: EmbeddedObjects property

This agent gets the names of the embedded objects in the Body item of the documents in a database.

import lotus.domino.*;
import java.util.Vector;
import java.util.Enumeration;
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();
      while (doc != null) {
        RichTextItem body = 
        (RichTextItem)doc.getFirstItem("Body");
        System.out.println(doc.getItemValueString("Subject"));
        Vector v = body.getEmbeddedObjects();
        Enumeration e = v.elements();
        while (e.hasMoreElements()) {
          EmbeddedObject eo = (EmbeddedObject)e.nextElement();
          System.out.println("\t" + eo.getName());
          }
        doc = dc.getNextDocument();
        }
    } catch(NotesException e) {
      System.out.println(e.id + " " + e.text);
      e.printStackTrace();
    }
  }
}