getFirstDatabase (NotesDbDirectory - JavaScript™)
Returns the first database from a server or the local directory, using the file type you specify.
Defined in
NotesDbDirectorySyntax
getFirstDatabase(type:int) : NotesDatabase
Parameter | Description |
---|---|
type |
Indicates the kind of database file you want
to retrieve:
|
Return value | Description |
---|---|
NotesDatabase |
The first database of the specified file type located in the directory, or null if the directory contains no databases of the specified type. |
Usage
The returned database is closed. If you do not open the database, only a subset of its methods are available. See isOpen in NotesDatabase.Each
time you call this method, the database directory is reset and a new
search is conducted. If you are searching for template files, for
example, a new call to getFirstDatabase with
the parameter NotesDbDirectory.DATABASE
starts searching
the directory from the beginning, this time for database files.
Examples
This data binding for a list box displays the names of all the databases in the current directory.var out = "";
var dir = session.getDbDirectory("");
var db = dir.getFirstDatabase(NotesDbDirectory.DATABASE);
while (db != null) {
out = out + db.getFileName() + "\n";
var tmpdb = dir.getNextDatabase();
db.recycle();
db = tmpdb;
}
return out