JAVA/CORBA CLASSES


Examples: setContentFromText method
This agent creates a document in MIME format.

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();
   }
 }
}

See Also