Examples: addValText method
This agent adds an encoded character to the "Subject" header.
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) {
MIMEHeader header = mime.getNthHeader("Subject");
if (header != null) {
String txt = "Æ";
header.addValText(txt, "iso-8859-1");
doc.save(true, true);
}
else System.out.println("No Subject header");
}
else
{
System.out.println
("Not MIME - " + doc.getItemValueString("Subject"));
}
doc = dc.getNextDocument(doc);
}
// Restore conversion
session.setConvertMIME(true);
} catch(Exception e) {
e.printStackTrace();
}
}
}