I wanto to open destination DB DATABASE1 (which has 2 views A1 & A2) and have an agent that first delete all documents he has inside and then copies documents from the other DB DATABASE2 (which has 2 views B1 & B2).
Subject: Copy documents from a database to another
Create an agent in DATABASE1.Copy this code in it:
Sub Initialize
Dim Session As New NotesSession
Dim DB1 As NotesDatabase, DB2 As NotesDatabase
Dim Collection As NotesDocumentCollection
Dim Document As NotesDocument
Set DB1 = Session.CurrentDatabase
Set DB2 = Session.GetDatabase(DB2_Server,"DB2_Folder\DB2_File_Name.nsf")
Set Collection = DB1.AllDocuments
Call Collection.RemoveAll(True)
Set Collection = DB2.AllDocuments
Set Document = Collection.GetFirstDocument
While Not Document Is Nothing
Call Document.CopyToDatabase(DB1)
Set Document = Collection.GetNextDocument(Document)
Wend
End Sub
Choose the target as “None”
All what you need to change is DB2_Server and DB2_Folder\DB2_File_Name.nsf to have the right values
Subject: RE: Copy documents from a database to another
Well thanks for the suggestion but it’s about 2 different DB type. The solution presented by Fadi on the previous response is exactly what I meant. Thanks anyhow for your hint.regards.
Subject: RE: Copy documents from a database to another
If this is just what you need, that’s fine.
Just remember, that replicas don’t have to be identical. You can replicate only selected documents and have completely different designs. However, configuring replication settings and ACLs might take some care.
If this is a one-time copy (or happens only occasionally), copying is much more reasonable. However, if there are many documents being copied day by day, be aware of the fact that many many deletion stubs will build up over time. This will also impact replicas of the target database, if any.
Again, if all this is no issue, the Script is a good solution.