This agent makes it easy to find orphan documents. It runs through all documents in the database and tests each...
response doc it finds to make sure its parent can be located. If an orphan is found the document is placed in a folder called Orphan for easy retrieval.
Dim Session As New NotesSession
Dim CurDB As NotesDatabase
Dim DocColl As NotesDocumentCollection
Dim Doc As NotesDocument
Dim Parent As NotesDocument
Set CurDB = Session.CurrentDatabase
Set DocColl = CurDB.AllDocuments
Set Doc = DocColl.GetFirstDocument
While Not(Doc Is Nothing)
If Doc.IsResponse Then
On Error Goto Orphan
Set Parent = CurDB.GetDocumentByUNID(Doc.ParentDocumentUNID)
Set Doc = DocColl.GetNextDocument(Doc)