getModifiedDocuments (NotesDatabase - JavaScript)

Gets the documents in a database that are modified since a specified time.

Defined in

NotesDatabase

Syntax

getModifiedDocuments() : NotesDocumentCollection

getModifiedDocuments(since:NotesDateTime) : NotesDocumentCollection

getModifiedDocuments(since:NotesDateTime, noteClass:int) : NotesDocumentCollection

Parameter Description
since The start time for collecting the modified documents. Defaults to the creation time of the database effectively returning all documents.
noteClass The type or types of document collected. You can combine types by adding them. Defaults to NotesDatabase.DBMOD_DOC_DATA which collects only data documents.
  • NotesDatabase.DBMOD_DOC_DATA 1
  • NotesDatabase.DBMOD_DOC_FORM 4
  • NotesDatabase.DBMOD_DOC_VIEW 8
  • NotesDatabase.DBMOD_DOC_ICON 16
  • NotesDatabase.DBMOD_DOC_ACL 64
  • NotesDatabase.DBMOD_DOC_HELP 256
  • NotesDatabase.DBMOD_DOC_AGENT 512
  • NotesDatabase.DBMOD_DOC_SHAREDFIELD 1024
  • NotesDatabase.DBMOD_DOC_REPLFORMULA 2048
  • NotesDatabase.DBMOD_DOC_ALL 32767
Return value Description
DocumentCollection A collection containing the modified documents.

Usage

The end time for the collection is the current database time, which is posted to the UntilTime property of the returned NotesDocumentCollection object. This time should be specified as the "since" time in a subsequent call to getModifiedDocuments where you want to get all modified documents since the most recent call. Do not rely on the system time, which may differ from the database time.

An exception occurs if the noteClass parameter is invalid.

Examples

This button gets all modified data documents in the current database since the last time the agent ran. A profile document saves the database end time for each operation.
try {

// Check UntilTime in profile document
var profile:NotesDocument = database.getProfileDocument("Profile", null);
var untilTime:NotesDateTime = null;
var dc:NotesDocumentCollection = null;
if (profile.hasItem("UntilTime")) {
	// Start processing from UntilTime
	var untilTimeVector = profile.getItemValueDateTimeArray("UntilTime");
	untilTime = untilTimeVector.firstElement();
	dc = database.getModifiedDocuments(untilTime, NotesDatabase.DBMOD_DOC_DATA);
} else {
	// First time through get all documents
	dc = database.getModifiedDocuments(null, NotesDatabase.DBMOD_DOC_DATA);
}

if (dc.getCount() > 0) {
	// Display LastModified and Subject from each document
	var doc:NotesDocument = dc.getFirstDocument();
	while(doc != null) {
		requestScope.status += doc.getLastModified().getLocalTime()
		+ " " + doc.getItemValueString("Subject") + "\n";
		var tmpdoc = dc.getNextDocument();
		doc.recycle();
		doc = tmpdoc;
	}
}
else {
	// If nothing modified since last time
	if (profile.hasItem("UntilTime")) {
		requestScope.status = "No documents modified since " + untilTime.getLocalTime();
	} else {
		requestScope.status = "No documents modified since beginning"
	}
}
      
// Write UntilTime back to profile document
profile.replaceItemValue("UntilTime", dc.getUntilTime());
profile.save(true, true, true);



} catch (e) {
	requestScope.status = e.toString();
}