NSFDbCreateAndCopy - Attempt to create duplicate template

Hi,

I am using C API to create databases from templates using API call :

nError = NSFDbCreateAndCopy(SourceTemplateName, TargetDBName, NOTE_CLASS_ALL, 0, 0, &hNotesDB);

But the R6 server keeps giving me an error on the console :

“Attempt to create duplicate tempalte - rejected.”

This happens only on R6 server. The same code works fine on R5 server.

Also note, my target is a database and not a template.

Any help or work around is greatly appreciated.

Thank You

Regards,

NBK

Subject: NSFDbCreateAndCopy - Attempt to create duplicate template

maybe your Db has templatename set, so the copy will also pose as template with the same name.

I’m not sure that server should disallow this as manually you can copy a DB without any problems template name or no tempalte name, but it could be some sort of protection.

Subject: RE: NSFDbCreateAndCopy - Attempt to create duplicate template

I am creating the database from a template. The target is a .nsf. If I create a new database from this template in the UI everything seems to be fine.

On R5 I do not get this error. But R6 Server gives me this error.

Subject: NSFDbCreateAndCopy - Attempt to create duplicate template

Any idea why this error is occuring on NSFDBCreateAndCopy on R6 ?

Anybody from LOTUS, Please help !

Thank You

Regards,

Bharat

Subject: Re: NSFDbCreateAndCopy - Attempt to create duplicate template

There’s new code in the Domino 6 server to prevent duplicate templates from occurring on the server. It’s to prevent things such as a user deciding that their customized mail database design IS the design template instead of inheriting from a design template :slight_smile:

I haven’t had the need to do what you’re doing yet, but try changing the NOTE_CLASS_ALL flag to NOTE_CLASS_ALL_NONDATA and see if it helps.

Is your code a standalone app or a server add-in task?

Subject: RE: Re: NSFDbCreateAndCopy - Attempt to create duplicate template

My code is a Server Task. But I also created a stand alone exe using just this API call.It still gives the same error.

Tried NOTE_CLASS_ALL_NONDATA - Did not help !

Regards,

NBK

Subject: I get an error, but the database gets created…

On the server console:

11/03/2003 03:37:59 PM Attempt by CN=Michael Cooper/O=Test to create duplicate template ExtR6Mail in database C:\Lotus\Domino\Data\mail6ex2.nsf - rejected.

The code snippet:

STATUS LNPUBLIC NotesMain(int argc,char *argv)

{

DBHANDLE dbhTarget;

char szSourcePath[MAXSPRINTF];

char szTargetPath[MAXSPRINTF];

char szTempStr[MAXSPRINTF];

STATUS error;

error = OSPathNetConstruct(NULL,“CN=mcoopert40/O=Test”,“mail6ex.ntf”,szSourcePath);

error = OSPathNetConstruct(NULL,“CN=mcoopert40/O=Test”,“mail6ex2.nsf”,szTargetPath);

error = NSFDbCreateAndCopy(szSourcePath,szTargetPath,NOTE_CLASS_ALL,0,0,&dbhTarget);

if (error != NOERROR)

{

OSLoadString(NULLHANDLE,ERR(error),szTempStr,(WORD)strlen(szTempStr)-1);

}

return NOERROR;

}

The net result is that I have a database called mail6ex2.nsf on my server that inherits from Mail6ex’s design.

Are you not getting a database at all?

Subject: RE: I get an error, but the database gets created…

The database gets created and seems to work just fine. What bothers me is this warning message and I want to get rid of this.

Regards,

NBK DOM