createParentEntity (NotesMIMEEntity - JavaScript™)
Creates a MIME entity and establishes it as the calling entity's parent. The calling entity becomes its first child.
Defined in
NotesMIMEEntitySyntax
createParentEntity() : NotesMIMEEntity
Return value | Description |
---|---|
NotesMIMEEntity | The new MIME entity. |
Usage
This method generates for the new parent a Content-Type header withmultipart/mixed
as the
value, and a boundary parameter.If the calling entity is named Body
(is
a top-level mail entity), associated envelope headers are promoted
to the parent. The calling entity does retain its Content-
headers.
Examples
This button gets the MIME entity in the current document. If the entry is not multipart, the button creates a parent entity. The button then appends a child entity.// Do not automatically convert MIME to rich text
session.setConvertMIME(false);
var doc:NotesDocument = currentDocument.getDocument();
var mime:NotesMIMEEntity = doc.getMIMEEntity();
if (mime != null) {
// If multipart MIME entity
if (!mime.getContentType().equals("multipart")) {
parent = mime.createParentEntity();
} else {
parent = mime;
}
mime = parent.createChildEntity();
var stream:NotesStream = session.createStream();
stream.writeText("Additional text.\n\n");
mime.setContentFromText(stream, "text/plain", NotesMIMEEntity.ENC_NONE);
doc.save(true, true);
} else {
requestScope.status = "Not MIME";
}
// Restore conversion
session.setConvertMIME(true);