Domino Code Fragment

Code Name*
Move Orphans to Folder
Date*
04/28/2024
Source (or email address if you prefer)*
Rlatulippe@romac.com
IP address:.18.119.139.50
Description*
Finds orphan documents and moves them to a folder
Type*
LotusScript
Categories*
(Misc)
Implementation:
Required Client:
Server:
Limitations:
Comments:
Files/Graphics attachments (if applicable): Code:
Sub Initialize
    Dim session As New NotesSession
    Dim db As NotesDatabase
    Set db = session.currentdatabase
    Dim doc As NotesDocument
    Dim Parentdoc As NotesDocument
    Dim collection As NotesDocumentCollection
    Dim dt As Variant
    Dim counter As Integer
   
    Set collection = db.alldocuments
    For x = 1 To collection.count
         Set doc = collection.GetNthDocument(x)
         If doc.Isresponse = True Then
              Set Parentdoc = db.GetDocumentByUNID(doc.ParentDocumentUNID)
              If (ParentDoc.Responses Is Nothing) Then
                   'Call doc.remove (True)
                   Call doc.PutInFolder( "Orphans" )
                   Counter = Counter + 1
              End If
         End If
    Next x
    Messagebox (Str(Counter) & " Documents were found")
End Sub