Examples: encodeContent method
This agent changes the encoding for a one-part MIME entity to None. If the entity content is already encoded (base64 or quoted-printable), the agent first decodes the entity.
import lotus.domino.*;
public class JavaAgent extends AgentBase {
public void NotesMain() {
try {
Session session = getSession();
AgentContext agentContext = session.getAgentContext();
// (Your code goes here)
// 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) {
if (mime.getEncoding() != MIMEEntity.ENC_BASE64) {
mime.decodeContent();
mime.encodeContent(MIMEEntity.ENC_BASE64);
doc.save(true, true);
}
}
else
{
System.out.println("Not MIME - " +
doc.getItemValueString("Subject"));
}
doc = dc.getNextDocument(doc);
}
// Restore conversion
session.setConvertMIME(true);
} catch(Exception e) {
e.printStackTrace();
}
}
}