remove (NotesNoteCollection - JavaScript)

Removes one or more notes from a note collection.

Defined in

NotesNoteCollection

Syntax

remove(removalspecifier:NotesAgent) : void

remove(removalspecifier:NotesDocument) : void

remove(removalspecifier:NotesDocumentCollection) : void

remove(removalspecifier:NotesForm) : void

remove(removalspecifier:int) : void

remove(removalspecifier:NotesNoteCollection) : void

remove(removalspecifier:string) : void

remove(removalspecifier:NotesView) : void

Parameter Description
removalspecifier The note to be removed. For int and string, the note ID; otherwise the associated object.

Examples

This button builds a note collection of documents from the current database. It removes any document with a subject containing the text "example" then exports the revised collection as DXL.
// Open DXL file
var stream:NotesStream = session.createStream();
var filename:string = "c:\\dxl\\";
filename = filename + database.getFileName();
filename = filename.substring(0, filename.length() - 3) + "dxl";
if (stream.open(filename)) {
	requestScope.status = "Opened " + filename;
	stream.truncate();

	// Create note collection
	var nc:NotesNoteCollection = database.createNoteCollection(false);
	nc.setSelectDocuments(true);
	nc.buildCollection();
	
	// Remove note if it contains word example
	var id:string = nc.getFirstNoteID();
	while (id.length() > 0) {
		var tmpid = nc.getNextNoteID(id);
		var doc:NotesDocument = database.getDocumentByID(id);
		var  subject:string = doc.getItemValueString("Subject");
		if (subject.toLowerCase().indexOf("example") >= 0) {
			nc.remove(id);
		}
		id = tmpid;
	}

	// Export note collection as DXL
	var exporter:NotesDxlExporter = session.createDxlExporter();
	var output:string = exporter.exportDxl(nc);
	stream.writeText(output);
	stream.close();
	requestScope.status = requestScope.status + "\n" + nc.getCount() +
		" notes written to " + filename;
} else {
	requestScope.status = "Cannot open " + filename;
}