Manage Learn to apply best practices and optimize your operations.

Agent to purge user mail

This tip describes how to create an agent to purge user mail.

Since we are pressed for space, I had to write an agent to purge the mail of the users. This agent is meant to purge the Users Inbox folder of any messages that is older than 90 days.


 Sub Initialize Dim s As New NotesSession Dim collection As NotesDocumentCollection Dim db As NotesDatabase Dim docSource As NotesDocument Dim dtNow As NotesDateTime Dim nextDocument As NotesDocument Dim View As NotesView Set db = s.currentdatabase Dim Counter As Double 'setup the date/time structures Set dtNow = New NotesDateTime("") dtNow.SetNow ' Set date to today Call dtNow.AdjustDay(-90) ' Move it back 90 days 'Get a hold of the Sent View Set View = db.GetView("($Inbox)") 'Go through all documents Set docSource = View.GetFirstDocument() Counter = 0 'Go through the documents then delete them if they are older than 90 days While Not(docSource Is Nothing) Set nextDocument = View.GetNextDocument(docSource) Set dtDelivered = New NotesDateTime(docSource.PostedDate(0)) If dtNow.TimeDifference(dtDelivered) >0 Then docSource.Remove True Counter = Counter + 1 End If 'Get a hold of the Next document in the View Set docSource = nextDocument Wend Print "Number of Documents deleted from Inbox: " & counter End Sub

Dig Deeper on Domino Resources - Part 2

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