From the Lotus Support Services Technote #1221862:
Problem
If you are an administrator of a large scale network, you might need to report on which Lotus Notes databases have soft deletions enabled and which do not. Is there a method to report if a database has this property enabled?
Solution to find soft deletions
You can use LotusScript to determine if a database has the „Allow soft deletions“ database property enabled. The property itself is tracked using the icon design element in the $Flags field. When the $Flags field contains a value of 4, then the property is enabled. To access the icon design element, you can make use of the NotesNoteCollection class introduced in Notes Domino 6.0. The class allows you to specify the types of design elements to gather in its collection using a series of boolean properties. To access the icon design element, you use the SelectIcon property. Once the design element is found, then its NoteID property can be used to access the element as a NotesDocument and the $Flags field contents can be accessed.
To cycle through all the databases on a server, you can use the NotesDbDirectory class. Note: When using this methodology, it is important to use error handling to avoid attempting to access databases that the agent executor does not have appropriate rights to open.
In the example below, the report is written to a text file. However, there are a number of ways the reporting of the information could take place, for example, using email, documents, or print statements, etc.
The agent example below should be designed to run on a collection of „None“. When the agent is executed, it cycles through all of the database on the specified server but only attempts to open and report on databases in the subdirectory specified. The code writes to a text file to report which databases have the „Allow soft deletions“ property enabled, and additionally reports on which databases it was unable to check because it did not have the rights to open them.
In order to use the agent, you need to update the following entries in the code for your environment: mailpath, filename, servername. These variables can be found under the text „PARAMETERS TO CODE“ in the agent.
NOTE: IBM Lotus Support is not able to customize this code for your environment. This code is meant as an example of how to use Lotus Script to accomplish this goal. It is strongly advised that the code be tested in a non-production environment before using it on a production server.
Dim db As NotesDatabase Dim nc As NotesNoteCollection Dim icon As NotesDocument Dim filenum As Integer Dim pos As Integer Dim found As Integer Dim filename As String Dim strOutput As String Dim nid As String Dim servername As String Dim mailpath As String Dim strFlags As Variant 'PARAMETERS TO CODE 'Indicate mail subdirectory name mailpath = "mail" 'Text filename to write the output to. Writes to Notes program directory. filename = "SoftDeletions.txt" 'Server name (in canonical format): servername = "server name" Dim dbdir As New NotesDbDirectory(servername) filenum = Freefile() Open filename For Output As fileNum Print #filenum, "Soft Deletions" Set db = dbdir.GetFirstDatabase(DATABASE) While Not db Is Nothing 'Skip databases which you don’t have access to On Error 4060 Goto Error4060 'Check to see if this database is in the mail directory pos = Instr(db.FilePath, mailpath) If pos = 1 Then Call db.Open(servername, db.FilePath) Set nc = db.CreateNoteCollection(False) nc.SelectIcon = True Call nc.BuildCollection nid = nc.GetFirstNoteId Set icon = db.GetDocumentByID(nid) strFlags = icon.GetItemValue("$Flags") found = Instr(strFlags(0), "4") If found <> 0 Then Print #filenum, db.FilePath & " has soft deletions enabled." End If End If maildb=False GetNextDb: Set db = dbdir.GetNextDatabase() Wend Close filenum Exit Sub Error4060: 'If the code reaches here then the user does not have access rights. Print #filenum, db.FilePath & " incorrect rights to access!" Resume GetNextDb