Manage Learn to apply best practices and optimize your operations.

Find Old Mail Files

If like me you inherited your Notes system with thousands of users already set
up then you might find the following useful.

I have created a database I call "Special Agent" the database has two agents in
it that do the following:

The first one, "Set ACL" goes through all the databases on a server and adds a
group, $NotesAdminGlobal, as Manager. This ensures you are manager of accounts
that you may have been taken out of.

The next agent checks through the Sent view of a database and returns the last
sent document date. If the database isn't a mail file or is blank then it
returns a blank.

I ran this on one server and I found 210 old accounts. I found one person who
hadn't sent mail since 1997 and guessed that they must have left !

You should create a database with a form called "Last" which has fields;
ServerName;Titles;FileName;Sent.

The code is simple and at the moment I am looking to extend the capabilities to
include counts of mail in the file, number of messages sent externally etc.

I hope you like it.









SET ACL AGENT

Sub Initialize

' This agent sets the access control on all datasbases to Manager for the
$NotesAdminGlobal group

Dim session As New notessession

' set the directory to new
' set db to directory and get the first Notes database or template in that
directory

Set directory = New NotesDbDirectory( "" )
Set db=directory.getfirstdatabase(TEMPLATE_CANDIDATE)

' loop through all the databases on the server until the value is null

Do While Not Isnull(db)
Call db.Open( "","") ' open the database
Call db.GrantAccess( "$NotesAdminGlobal",ACLLEVEL_MANAGER ) ' Grant
the Manager access to NotesAdminGlobal
Set db = directory.getnextdatabase ' get the next database
Loop

Print "ACL's updated" ' Print when complete.

End Sub

SECOND AGENT - GET LAST SENT DOCUMENT AGENT

Sub Initialize

' Not changed yet
Dim session As New notessession
Dim directory As NotesDbDirectory

Dim collection As NotesDocumentCollection
Dim doc As NotesDocument

' Set the directory. Blank on this means the local computer. Otherwise
enter ("Notes01/CPL/Leeds/Ventura") or have a selection.

'Dim servername As String

serverName = Inputbox$("Please enter the server name you wish to
search.","Server Name")

Set directory = New NotesDbDirectory(ServerName)

Dim db As NotesDatabase
Set db = directory.GetFirstDatabase( Database )

' set out your declarations
Dim count As Integer
Dim dbname() As String
Dim dbfilenname() As String
Dim dbSent() As Variant

Dim view As NotesView

' set the notes database to the first in the directory

Print "Please wait....."
count = 1
' do the loop below until all the databases have been accounted for.
Do While Not (db Is Nothing)
On Error Resume Next
Redim Preserve dbname(1 To count)
Redim Preserve dbfilename(1 To count)
Redim Preserve dbSent(1 To count)
dbfilename(count) = db.filename
Call db.Open( "","") ' If you do not open the database you cannot get
the number of documents contained in it.
Set view = db.GetView( "($Sent)" )
dbname(count)=db.Title
Set doc = view.GetFirstDocument
dbSent(count) = Format(doc.PostedDate(0),"Long Date")
count=count+1
If count > 1000 Then Exit Do
' get the next database in the directory ( this does not need any
arguments)

Set db = directory.GetNextDatabase

Print count
Loop

' now create the summary report in the current database


Set db=session.currentdatabase
Dim sumdoc As NotesDocument
Set sumdoc=db.createdocument

sumdoc.form="Last"
sumdoc.serverName = serverName
sumdoc.Titles=dbname
sumdoc.filename=dbfilename
sumdoc.sent= dbSent


Call sumdoc.save(True,False)

Print "Done. - Job complete..."
End Sub

Dig Deeper on Domino Resources

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.

-ADS BY GOOGLE

SearchWindowsServer

Search400

  • iSeries tutorials

    Search400.com's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...

SearchDataCenter

SearchContentManagement

Close