Domino Code Fragment

Code Name*
Limit deletes in QueryDocumentDelete to response documents only
Date*
04/28/2024
Source (or email address if you prefer)*
Rlatulippe@romac.com
IP address:.3.140.198.173
Description*
Checks to ensure that only response documents are being deleted.
Type*
LotusScript
Categories*
(Misc)
Implementation:
Required Client:
Server:
Limitations:
Comments:
Files/Graphics attachments (if applicable): Code:
Sub Querydocumentdelete(Source As Notesuidatabase, Continue As Variant)
'Delcare the database and document(s) this agent is working on
    Dim uidb As notesUIdatabase
    Dim collection As notesdocumentcollection
    Dim doc As Notesdocument
   
'NotesUIDatabase class is only accessible as a source parameter
    Set uidb = source
   
'Get to the document(s) selected for deletion
    Set collection = uidb.documents
    Set doc = collection.GetFirstDocument
   
'Walk through the document collection.
    Do
'If any documents is not a response warn the user and stop the deletion
         If doc.IsResponse = False Then
'Tell the user they cannot delete the document
              Messagebox doc.DispRestrictionTitle(0) & Chr(13) & Chr(13) & "Is a the parent document and cannot be deleted!", 16, "Invalid Deletion Attempt!"
'Stop execution of the delete process
              Continue = False
'Bail out of the program if a document is marked as "Permanent"
              Exit Sub
         End If
'Otherwise, get the next document in the collection

          Set doc=collection.GetNextdocument(doc)
'Go through the process of checking for response documents until there are no document(s) left
    Loop Until doc Is Nothing
   
End Sub