Jim Fricker commented on Sep 4, 2012

Re: Create an empty NotesDocumentCollection

This is my preferred method of creating a reliable (keyword here) empty NotesDocumentCollection....

Set dc = db.GetProfileDocCollection(Chr$(13))

How many form names have you seen that consist of just a CR character?

Anže Bajde commented on Aug 6, 2009

6) Profiledocument.Responses

I think the best way or the fastest is to get empty collection by Set collection = docProfile.Responses.

Terry Boyd commented on Feb 4, 2009


I have found that the fastest way to create a blank collection is to use the GetProfileDocCollection method on the NotesDatabase object. You then don't even require a view object (as with GetAllDocumentsByKey).

You simply reference a profile document that doesn't exist - e.g. Set collection = thisDb.GetProfileDocCollection( "NOSUCHTHING" ).

Esther Strom commented on Nov 26, 2008


The most commonly-used technique at my company is to just call GetAllDocumentsByKey on a view, using a key that you know will never exist (usually a combination of strange characters like "@#*"). Works like a charm.

Karl-Henry Martinsson commented on Nov 26, 2008

Lists are very powerful

You can also create a list of your own data object (classes), containing not only a NotesDocument but also other info. I am using that extensivly in my applications, makes it very powerful.

devin olson commented on Nov 26, 2008

I use the GetProfileDocCollection method

From my libTools Library:

Public Function getEmptyDocumentCollection(source As NotesDatabase) As NotesDocumentCollection

%REM This function intentionally has NO ERROR TRAPPING. Errors must be handled by the calling code.


' * Creates an empty NotesDocumentCollection from the source database.

' *

' * @param source NotesDatabase from within which to create the empty document collection.

' * @return NotesDocumentCollection containing zero documents.

' */


Dim result As NotesDocumentCollection

Set result = source.GetProfileDocCollection("*INVALID*")

While (result.Count > 0)

Call result.DeleteDocument(result.GetFirstDocument())

Wend ' (result.Count > 0)

Set getEmptyDocumentCollection = result

End Function ' getEmptyDocumentCollection



Vince Schuurman commented on Nov 26, 2008

List datatype limit

Watch out for the 'out of handle' error that could crash your server if you have to many documents in your list.

ND5 and ND7 10495, ND6 6399, Not sure about ND8.