Lotus Notes FAQ Visit Our Sponsor!

How do you create a NotesDocumentCollection?


A NotesDocumentCollection is useful for storing a set of documents that you later want to put into a folder or delete; it's a lot faster to make one call than to delete or folder documents one at a time. Unfortunately, there's no simple way to do this such as "Dim dc As NotesDocumentCollection" which is what most people would try. Instead, you have to get it by using one of the search collection APIs with a key that can't be found such as this:

Dim session As New NotesSession
Dim dc As NotesDocumentCollection
Set dc = session.CurrentDatabase.GetProfileDocCollection("nonexistingform") 

or by doing this:

Dim session As New NotesSession
Dim db As NotesDatabase
Set db = session.CurrentDatabase
Dim view As NotesView
Set view = db.GetView("($All)")
Dim dc As NotesDocumentCollection
Set dc = view.GetAllDocumentsByKey("12345") ' non-existent key


Applies to Notes Versions: 5 6 6.5 7
Last Modified: September 14, 2006