removeAttachment (NotesXspDocument - JavaScript)

Removes an attachment in the document.

Syntax

removeAttachment(fieldName:string, attachmentName:string) : boolean
Parameter Description
fieldName The name of the item containing the attachment.
attachmentName The name of the attachment.
Return value Description
boolean True if the attachment is successfully removed; false otherwise.

Usage

You must save (NotesXspDocument - JavaScript) the document for the change to take effect in the data store.

Examples

This button onclick event removes an attachment from the body item if it exists.
if (document1.getAttachmentList("body").isEmpty()) {
	requestScope.alist = "No attachments in body";
} else {
	if (document1.removeAttachment("body", requestScope.rname)) {
		document1.save();
		requestScope.alist = "Attachment " + requestScope.rname + " removed from body";
	} else {
		requestScope.alist = "Attachment " + requestScope.rname + " does not exist";
	}
}