Hi,
I would like to copy docs ‘A’ from one database to another database, in this new database the form will have name ‘B’ instead o A but all fileds name will be the same.
I have tried CopyAllItems and CopyToDatabase but with no sucess.
Any help ?
Thanks in advance
Subject: Copy from one database to another with a different doc name
after copytodatabase, did you then use doc.form = “B” and doc.save?
Subject: Copy from one database to another with a different doc name
You could copy the document to the new database and then set the form e.g.
set newdoc = doc.copytodatabase(newdb)
newdoc.form=“b”
Regards
Ethann Castell
font color=“#FF7700”>Caliton Innovations
www.caliton.com]
Subject: RE: Copy from one database to another with a different doc name
When using NotesDocument.CopyToDatabase() you would need to write the document 2 times to disk, once when copying, and once when saving the document after you have changed the Form field.
I would use NotesDocument.CopyAllItems() instead, as you need to save the document only once then, and thus your agent runs much faster and takes up less resources on the server:
Sub Initialize
Dim dba As New notesdatabase("","copya")
Dim dbb As New notesdatabase("","copyb")
Dim cola As notesdocumentcollection
Dim doca As notesdocument
Dim docb As notesdocument
Set cola=dba.UnprocessedDocuments
Set doca=cola.getfirstdocument
While Not doca Is Nothing
Set docb=dbb.createdocument
doca.copyallitems docb
docb.Form="FormB"
docb.save True,False
Set doca=cola.GetNextDocument(doca)
Wend
End Sub
Subject: RE: Copy from one database to another with a different doc name
Thanks to all
I was using CopyAllItems but missed to change doc.form name
Now is working !
Thanks a lot
Paulo