Examples: Charset property (MIMEEntity - Java™)
This agent displays the character set for a MIME entity.
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);
DocumentCollection dc = agentContext.getUnprocessedDocuments();
Document doc = dc.getFirstDocument();
while (doc != null) {
MIMEEntity mime = doc.getMIMEEntity();
if (mime != null) {
System.out.println(doc.getItemValueString("Subject"));
if (mime.getContentType().equals("text")) {
System.out.println("Character set is " + mime.getCharset());
}
else
{
System.out.println("Not text");
}
}
else
{
System.out.println("Not MIME - " +
doc.getItemValueString("Subject"));
}
doc = dc.getNextDocument(doc);
}
// Restore conversion
session.setConvertMIME(true);
} catch(Exception e) {
e.printStackTrace();
}
}
}