Frank Yuan
Frank Yuan

Reputation: 131

IBM Domino: Merge NotesDocument From Two Databases

I'm working on a function to union documents from two databases (normal database and archive database, the structures are same). I tried this code

Set result = db.CreateDocumentCollection
Call result.AddDocument(doc) 'doc is from another database

but there is an error "Error 4427: Document is from a different database". And I saw notesDocumentCollection.Merge also needs the documents to be in the same database. Is there any way to merge documents from two databases?

Upvotes: 0

Views: 222

Answers (1)

Richard Schwartz
Richard Schwartz

Reputation: 14628

A NotesDocumentCollection object has a Parent property, which is a NotesDatabase. Internally, it is just a list of NoteIDs representing NotesDocument objects. Since NoteIds are not unique across databases, those NoteDocument objects have to be from the same NotesDatabase. The same thing is true for the NotesNoteCollection, too. If you need a collection that includes NotesDocuments from multiple databases, you're going to have to build your own class for that.

Upvotes: 1

Related Questions