copyToDatabase in a Java Agent

Thanks for previous reply on copyToDatabase feature. Problem is I have to do this in a Java agent in notes - it 's an existing agent that has quite a bit of functionality in it.

I have an array of database locations called DB_LOCS

When certain variables are applicable, it will pick a database location from the array.

When I apply the following code:-

Document newNotesDocument = currentEmailDocument.copyToDatabase (DB_LOCS[i]);

newNotesDocument.putInFolder (“Processed”);

The compiler flags up an error on the first line stating:-

"Incompatible type for declaration. Can’t convert java.lang.String to lotus.domino.Database

The array value is “server\folder\database.nsf”

I think that it may have something to do with setting the target database up in the code and something to do with AgentContext from what i can tell with the help, but I’m not sure.

Any ideas?

Subject: copyToDatabase in a Java Agent

You’ll have to get a handle to the database first before you can copy a document to it. DB_LOCS[i] is a string, not a database object.

Something like:

Database db = session.getDatabase(“servername”,DB_LOCS[i]);

Document newNotesDocument = currentEmailDocument.copyToDatabase (db);

Subject: RE: copyToDatabase in a Java Agent

Quite possibly the two sweetest words in the English Language - “Successful Compile”!!

Thanks Rene!