How I get an Empty NotesDocumentCollection

Tomorrow is Thanksgiving here in the US, so I figured I'd post this one a day early. I also posted this as a response to Andre Guirard's Lotus Domino Designer wiki post: Create an empty NotesDocumentCollection. I've reposted it here primarily so that I can format it in a manner more pleasing to my eye. (I'm weird that way). Enjoy:
Public Function getEmptyDocumentCollection(source As NotesDatabase) As NotesDocumentCollection
%REM This function intentionally has NO ERROR TRAPPING. Errors must be handled by the calling code.
Dim result As NotesDocumentCollection
Set result = source.GetProfileDocCollection("*INVALID*")
While (result.Count > 0)
Set getEmptyDocumentCollection = result
End Function ' getEmptyDocumentCollection
%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.
' */
%END REM' * 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
Comments
Posted by Mikkel Heisterberg At 01:38:36 PM On 11/26/2008 | - Website - |
Posted by Devin Olson At 01:53:16 PM On 11/26/2008 | - Website - |