Sub GetRespCol(ACol As NotesDocumentCollection, ADoc As NotesDocument)
Dim resp As NotesDocumentCollection
Dim respdoc As NotesDocument
Dim firstTime As Boolean
Set resp = ADoc.Responses
If ACol Is Nothing Then
Set ACol = ADoc.Responses
Call ACol.AddDocument(ADoc)
firstTime = True
End If
Set respdoc = resp.getFirstDocument
While Not(respdoc Is Nothing)
Call GetRespCol(ACol, respdoc)
If Not(firstTime) Then
Call ACol.AddDocument(respdoc)
End If
Set respdoc = resp.GetNextDocument(respdoc)
Wend
End Sub
Sub Initialize
Dim s As New NotesSession
Dim doc As NotesDocument
Dim resp As NotesDocumentCollection
Set doc = s.CurrentDatabase.UnprocessedDocuments.GetFirstDocument
Call GetRespCol(resp, doc)
Print "START"
Set doc = resp.GetFirstDocument
While Not(doc Is Nothing)
Print doc.UniversalID
Set doc = resp.GetNextDocument(doc)
Wend
End Sub