createCopy (NotesDatabase - JavaScript™)
Creates an empty copy of the current database.
Defined in
NotesDatabaseSyntax
createCopy(server:string, dbfile:string) : NotesDatabase
createCopy(server:string, dbfile:string, maxsize:int) : NotesDatabase
Parameter | Description |
---|---|
server |
The name of the server where the new database
resides. Specify null or an empty string ("" ) to
create a local copy. |
dbfile |
The file name of the new copy. |
maxsize |
The maximum size (in gigabytes) that you would like to assign to the new database. This parameter applies only to Release 4 databases or those created on a server that has not been upgraded to Release 5. Entering an integer greater than 4 generates a runtime error. |
Return value | Description |
---|---|
Database |
The new copy. |
Usage
If a database with the specified file name already exists, an exception is thrown.The copy contains the design elements of the current database, an identical access control list, and an identical title. It does not contain any documents.
The copy is not a replica.
Programs using remote (IIOP) calls to
a server can't create or access databases on other servers. In these
cases, the server parameter must correspond to the server the program
is running on. There are two ways to do this:
- Use null or an empty string (
""
) to indicate the current computer. This is the safer method. - Make sure the name of the server that the program runs on matches
the name of
server
.
Programs running on a client can access several different servers in a single program.
The ACL of the original database gets copied to the new database, but you may want to modify the copy's ACL. For example, you may want Manager access to the copy for yourself even if you're not a manager of the original. Use the methods grantAccess and revokeAccess to modify the copy's ACL.
Examples
This button makes a local copy of the local databasenames.nsf
. var db:NotesDatabase = session.getDatabase(null, "names");
var title:string = db.getTitle();
try {
var db2:NotesDatabase = db.createCopy(null, "names2");
db2.setTitle("Copy of names");
requestScope.status = "Database \"" + title + "\" copied locally";
} catch(e) {
requestScope.status = "Error: database \"" + title + "\" not copied locally";
}