CreateCopy in Web Agent

I have an agent that I need to run from the web. It needs to make copies of databases and then add some documents. This works when I run from client, but on the web the databases are not being created.

The script seems to think the databases are being created: my function returns valid (?) NotesDatabase objects with Replica IDs. There are no script or server console errors but the databases are not anywhere on the server. Here’s my code:

Public Function CopyDatabase(ServerName As String, SourceDBPath As String, TargetPath As String) As NotesDatabase

	On Error Goto ErrHandler

	

	Dim dbToCopy As NotesDatabase

	Set dbToCopy = GetExternalDatabaseByFilePath(SourceDBPath,ServerName)

	If Not dbToCopy Is Nothing Then

		Dim newDB As New NotesDatabase("","")

		Set newDB = dbToCopy.CreateCopy(ServerName,TargetPath)

		newDB.Title = dbToCopy.Title

		Set CopyDatabase = newDB

	End If		

	Exit Function

ErrHandler:

	Set CopyDatabase = Nothing

	Exit Function

End Function

We are running designer 7, server 8.

Thanks for any help.

Subject: CreateCopy in Web Agent

Do you reallly need a copy of an existing database ?Maybe create db’s from template ?

We create already 100s of databases without any problem.

Subject: CreateCopy in Web Agent

Having never done this … Random thoughts when I read this

(1) The person who signed the agent running, do they have unrestricted rights to create a database and effectively create a database on the server?

(2) You said you are getting a database, is it possible it’s only in “memory” and you need to save something to the harddrive. I don’t see a DB.save method.

(3) Even if you wrote the DB out, how would you access it? Not ACL seems to be setup. I guess you would get the default. But first you’d have to see a db which you’re not, so that goes back to point 2.

Subject: RE: CreateCopy in Web Agent

Thanks for the response. Answers:

  1. Yes. Security is configured correctly for the agent.

  2. The “DatabaseCopy” method of NotesDatabase performs the save.

  3. “DatabaseCopy” copies the ACL from the source database.

I’ve even gone into Windows explorer on the server to look for database files, but no luck.