IBM Support

Using LotusScript to generate a report with mail database information

Technote (FAQ)


You want to generate a report in Lotus Notes® with information (owner, size, template. and so on) regarding mail databases on a server. How do you do this?


You can use a LotusScript agent to generate the report (the LotusScript code example below is one way to generate such a report).

For each person listed in the Domino Directory, the code generates a entry noting the mail file owner, database size, and the mail database template in use. The code mails the report in a memo to the administrator or mail-in database specified in the code. The script can be modified to gather other relevant information from the Person Document and/or the mail database.

NOTE: The code below is a sample script, provided to illustrate one way to approach this issue. It is to be used as is and at your own risk. In order for this example to perform as intended, the script must be laid out exactly as indicated below. Product Support cannot customize this script for specific environments or applications.


1. The agent requires that its Target property be set to None.

2. The agent can be set up to run manually or on a schedule. To run manually, set the Trigger property to "On event" and the Runtime property to "Action menu selection".

3. You must provide details to two of the code lines within the agent. One line requires the name of the server where the Domino Directory to be accessed resides. The second line requires the name of an administrator or mail-in database to whom the report can be mailed. These lines are preceded by a line in UPPERCASE text that notes the detail required.

4. The code below should be placed into the Initialize event of the agent.

5. The mail file should be executed by an administrator who has Manager rights to the mail files that will be reported on. In addition or as alternative, you may want to use the Full Access Administration feature to ensure that the necessary rights are granted to the user executing the agent.

      Dim s As New Notessession
      Dim nab As New Notesdatabase("<server name>", "names.nsf")
      Dim report_db As Notesdatabase
    'The pdoc variable provides a handle to the Person Document
      Dim pdoc As NotesDocument
      Dim report As NotesDocument
      Dim view As NotesView
      Dim temp As String

      Set report_db = s.currentdatabase
      Set report = report_db.CreateDocument
      report.form = "Memo"
      Dim rt As New notesrichtextitem(report, "Body")

      Set view = nab.GetView("People")
      Set pdoc = view.GetFirstDocument
      While Not pdoc Is Nothing
        On Error Resume Next
    'The mail_db variable provides a handle to the mail database
        Dim mail_db As New NotesDatabase(pdoc.mailserver(0), pdoc.mailfile(0))
        If mail_db.IsOpen Then
          temp = "Mail Owner: " & pdoc.fullname(0) & " Size: " & Cstr(mail_db.size) & " _ bytes Template: " + mail_db.DesignTemplateName
          temp = "Could not open mail file for: " & pdoc.fullname(0) & " Server: " & _ pdoc.mailserver(0) & " , " & pdoc.mailfile(0)
        End If
          temp = ""
          Set pdoc = view.GetNextDocument(pdoc)
      Call report.send(False, "<admin name>")

Supporting information:
The Domino Administrator client's File view provides columns which detail the following Database Properties: title, file name, path, file format, size, maximum size, quota, warning, creating, last fixup, is logged, template, space used.

    Cross reference information
    Segment Product Component Platform Version Edition
    Messaging Applications IBM Domino Designer Not Applicable Windows 8.0, 7.0, 6.5, 6.0 All Editions

Document information

More support for: IBM Notes

Software version: 8.0.2, 8.5.3

Operating system(s): Linux, Windows

Software edition: All Editions

Reference #: 1268625

Modified date: 05 November 2007