例: setContentFromText method

次のエージェントは、MIME 形式で文書を作成します。

import lotus.domino.*;

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);
      Database db = agentContext.getCurrentDatabase();
      Document doc = db.createDocument();
      doc.replaceItemValue("Form", "Memo");
      MIMEEntity body = doc.createMIMEEntity();
      header = body.createHeader("Subject");
      header.setHeaderVal("MIME one-part message");
      stream.writeText("Text of message.");
      body.setContentFromText
      (stream, "text/plain;charset=UTF-8", MIMEEntity.ENC_IDENTITY_7BIT);
      stream.close();
      doc.save(true, true);
      // Restore conversion
      session.setConvertMIME(true);
     
    } catch(Exception e) {
      e.printStackTrace();
    }
  }
}