Auditing document deletion

Share

Domino does not have a code to notify administrators when users are deleted from names.nsf i need to know who deleted the user.
 To solve this problem i wrote an agent to do the job.  
Just put the code on database script inside the QueryDocumentDelete.

Sub Querydocumentdelete(Source As Notesuidatabase, Continue As Variant)
        Dim docMemo As NotesDocument
        Dim docsDelete As NotesDocumentCollection
        Dim ses As New NotesSession
        Dim db As NotesDatabase
        Set db = ses.currentdatabase
        Set docMemo = New NotesDocument(db)
        Set docsDelete = Source.Documents ‘ Selected documents
        For x = 1 To docsDelete.count
                Set doc = docsDelete.GetNthDocument( x )
                If doc.form=”Person” Then
                docMemo.Form=”memo”
                docMemo.SendTo = “Administrator/Acmel”
                docMemo.subject = “Document delection”
                Set rtbody = New NotesRichTextItem (docMemo, “Body”)        
                Call rtbody.AppendText  (“Deleted by ” + ses.UserName + ” – “+ Cstr(doc.StartDateTime(0)) + ” – ” + doc.Subject(0) +” – User Name = ” + doc.FullName(0))
                Call docMemo.Send(False)
      End if
        Next
       
End Sub