Examples: getSomeHeaders method

This agent gets the Subject and From headers in the MIME entity in the current document.

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)
      Stream stream = session.createStream();
      // Do not convert MIME to rich text
      session.setConvertMIME(false);
      DocumentCollection dc = agentContext.getUnprocessedDocuments();
      Document doc = dc.getFirstDocument();
      while (doc != null) {
        MIMEEntity mime = doc.getMIMEEntity();
        if (mime != null) {
          System.out.println(doc.getItemValueString("Subject"));
          Vector filter = new Vector();
          filter.addElement("Subject");
          filter.addElement("From");
          System.out.println(mime.getSomeHeaders(filter, true));
        }
        else
        {
          System.out.println("Not MIME - " +
            doc.getItemValueString("Subject"));
        }
        doc = dc.getNextDocument(doc);
      }
      // Restore MIME conversion
      session.setConvertMIME(true);
     
    } catch(Exception e) {
      e.printStackTrace();
    }
  }
}