remove (NotesDocument - JavaScript)

Deletes a document from a database, doing a soft deletion if soft deletions are enabled and a hard deletion otherwise.

Defined in

NotesDocument

Syntax

remove(force:boolean) : boolean
Parameter Description
force If true, the document is removed even if another user modifies the document after your program opens it. If false, the document is not removed if another user modifies it.

Return Value

  • true if the document is successfully removed
  • false if the document is not deleted because another user modified it and the force parameter is set to false

Usage

This method does a soft deletion if "Allow soft deletions" is enabled. See removePermanently to do a hard deletion.

A document that is deleted cannot be used as the basis for navigation in a view or document collection.

Examples

This button removes all the documents in a folder.
var view:NotesView = database.getView("oldstuff");
var doc:NotesDocument = view.getFirstDocument();
while (doc != null) {
	var subject:string = doc.getItemValueString("Subject");
	doc.remove(true);
	requestScope.status += "\n\"" + subject + "\" removed";
	doc = view.getFirstDocument(); 
}