this is not only a XPages question, but also a Lotusscript question.
If you have an exist Body MIMEEntity field and you would add for example attachment in Lotuscript Code or Java Code...how can you do it? I have investigate more time without success
Read my previus question to understand the code so you can see for example that I need to attach the attachments from another notes document (or filesystem is the same)
I re-insert the example code (I need to add the attachments from another RT MIME Field to another RT MIME field names Body, but after this code...the output of Body is damaged and show only the new attachments..and lose the original content..someone know why? ):
session.setConvertMime(false);
var doc:NotesDocument=document1.getDocument(true);
var mimeRoot:NotesMIMEEntity=doc.getMIMEEntity("Body");
var docAttach:NotesDocument=database.getDocumentByUNID('XXXXXXXUNID'); //doc where are the attachmetns files MIME or RICHTEXT
var XSPReply=wrapDocument(docAttach); //function in Xsnippets from Opentntf.org
var listattachs=XSPReply.getAttachmentList("Body");
for (var i=0; i<listattachs.length; i++) {
var is=null;
var att = listattachs[i];
var persistentName = att.getPersistentName()==null?att.getName():att.getPersistentName();
var cid = att.getCID();
var eo:NotesEmbeddedObject = docAttach.getAttachment(persistentName);
if (null != eo) {
var child:NotesMIMEEntity=mimeRoot.createChildEntity(); //create child of original mail
var emailHeader:NotesMIMEHeader = child.createHeader("Content-Disposition");
emailHeader.setHeaderVal("attachment; filename=\"" + persistentName+ "\"");
emailHeader = child.createHeader("Content-ID");
emailHeader.setHeaderVal("<" + cid + ">");
var is = new java.io.BufferedInputStream(eo.getInputStream());
var stream:NotesStream = session.createStream();
stream.setContents(is);
child.setContentFromBytes(stream, att.getType(),NotesMIMEEntity.ENC_IDENTITY_BINARY);
}
}
doc.closeMIMEEntities(true,"Body")
doc.save()
session.setConvertMime(true);
Seem simple...but I don't find how correctly edit exist my NotesMimeEntity (that is different to create a new NotesMimeEntity)
Tnx you very much!