getMIMEEntity (NotesDocument - JavaScript)

Gets a top-level MIME entity.

Defined in

NotesDocument

Syntax

getMIMEEntity() : NotesMIMEEntity

getMIMEEntity(itemName:string) : NotesMIMEEntity

Parameter Description
itemName The name of the item containing the MIME entity. Body is the default.
Return value Description
MIMEEntity The MIME entity.

Usage

An item containing a MIME entity is of type NotesItem.MIME_PART.

This method returns null if the requested item does not exist or is not of type NotesItem.MIME_PART.

This method is equivalent to NotesDocument.getFirstItem followed by NotesItem.getMIMEEntity.

On an XPage, you can use getContentAsText to set the value of a rich text control.

A rich text control set from getContentAsText is not immediately accessible as a com.ibm.xsp.http.MimeMultipart object and programmatic access returns null. The user must first make an edit in the control.

Examples

This button gets the MIME content from the current document.
var doc:NotesDocument = currentDocument.getDocument();
var mime:NotesMIMEEntity = doc.getMIMEEntity();
if (mime != null) {
	var m:string = "Content type: " + mime.getContentType() + "\n" +
	"Content subtype: " + mime.getContentSubType() + "\n" +
	"Character set: " + mime.getCharset() + "\n" +
	"Encoding: " + mime.getEncoding();
	requestScope.status = doc.getItemValueString("Subject") + "\n" + m + "\n" +
	mime.getHeaders() + "\n" + mime.getContentAsText();
} else {
	requestScope.status = "Not MIME - " + doc.getItemValueString("Subject");
}
This button sets the value of a rich text control (bound to requestScope.body) with the value of a rich text item (body) in the current document.
var doc:NotesDocument = currentDocument.getDocument();
if (doc.hasItem("body")) {
	var entity:NotesMIMEEntity = doc.getMIMEEntity("body");
	if (entity != null) {
		requestScope.body = entity.getContentAsText();
	}
}