Combine Docs from Two Databases into One View

Hello! I’m trying to combine documents from two databases into one view. I tried using a folder and the method AddAlltoFolder error message reads “You are not authorized to perform that operation” when I tried to add the docs from the other database. I tried searching the forum but came up with no results. Anyone’s help is greatly appreciated. Thank you!

My code:

Sub Postopen(Source As Notesuiview)

Dim s As New NotesSession

Dim SPdb As NotesDatabase

Dim db As NotesDatabase

Dim SPcollection As NotesDocumentCollection

Dim spviewcollection As NotesViewEntryCollection

Dim spview As NotesView

Dim folderview As NotesView

Set spdb = s.GetDatabase(“BUF-DOM-001” ,“vhd\sprtrack.nsf”) 'Get the S&P database

Set db = s.CurrentDatabase 'Get the repository

Set spview = db.GetView(“ProjectLookup”) 'Get the repository view that contains projects.

Set spviewcollection = spview.AllEntries 'Add all the entries in the view to a collection

searchFormula$ = {Form = “sprform”} 'Create the search query.

Set spcollection = spdb.Search( searchFormula$, Nothing, 0 ) 'Put the documents from the S&P database into a collection.

Call db.EnableFolder( “S&P Documents” ) 'Create the folder if it doesn’t exist.

Call spviewcollection.PutAllInFolder(“S&P Documents”, True) 'Add the S&P documents to the folder.

Call spcollection.PutAllInFolder(“S&P Documents”, True) 'Add the repository documents to the folder.

End Sub

Subject: Combine Docs from Two Databases into One View

The error message is misleading – you need to copy the documents to the database before you can put them in the folder. A view or folder can only display documents in the current database (unless you are using the DB2NSF back end and a DB2 Query View, which is unlikely).