openDatabaseIfModified (NotesDbDirectory - JavaScript)

Opens a database if it has been modified since a specified date.

Defined in

NotesDbDirectory

Syntax

openDatabaseIfModified(dbfile:string, date:NotesDateTime) : NotesDatabase
Parameter Description
dbfile The file name of the database.
date A cutoff date. If one or more documents in the database were modified since this date, the database is opened; if not, it is not opened. Cannot be null.
Return value Description
NotesDatabase The opened database, or null if the database is not opened due to the modification date. An exception occurs if the database cannot be opened for any other reason.

Examples

This button opens the local names.nsf if it was modified in the last 3 hours.
var dir:NotesDbDirectory = session.getDbDirectory(null);
var dt:NotesDateTime = session.createDateTime("Today");
dt.adjustHour(-3);
try {
	var db:NotesDatabase = dir.openDatabaseIfModified("names", dt);
} catch(e) {
	requestScope.status = "Database cannot be opened";
	return;
}
if (db != null) {
	requestScope.status = "Database opened";
} else {
	requestScope.status = "Database not modified in past 3 hours";
}