Archiving agent

I am new to writing agents, and need some advise. I have found no administrative way to do this, so I think an agent will be necessary. I want to exempt certain folders from being archived. Does anyone have an agent they arewilling to share that would:

  1. If the message is in the Save folder or the Legal folder (or subfolders under them), nothing happens.

  2. If the message is not in one of the above folders and has not been created or modified in the last 7 years - create a “to be deleted” folder (if one is not already there) and move the message to it.

We will then give users some time to go through their “to be deleted” folder and move anything they need to keep to the Save folder - before we delete the “to be deleted” folder.

We will then change the time to 5 years, then 3, then 1. TIA for your help.

Subject: Re: Archiving agent

Here is your script

Dim session as New Notessession

Dim datetime as New Notesdatetime ( Today )

Dim datetime as Notesdatetime

Dim currdb as Notesdatabase

Dim archivedb as New Notesdatabase ( “Your Server”, “Your filepath” )

Dim view as Notesview

Dim collection as NotesDocumentCollection

Dim doc as Notesdocument

Dim viewnames as Variant

Set currdb = session.currentdatabase

Call datetime.AdjustYear ( - 7 )

'- - set and clear the collection

Set collection = currdb.Search ( |Form=“Nothing”|,Nothing, 0 )

if collection.Count > 0 then

Set doc = collection.getfirstdocument

Do While Not doc is nothing

Call collection.DeleteDocument( doc )

Set doc = collection.getfirstdocument

Loop

End if

'- - scourge the views and documents

viewnames = currdb.Views

For i = 0 to Ubound ( viewnames )

Set view = currdb.getview ( viewnames ( i ) )

If ( view.Name = “Save” OR view.Name = “Legal” ) = False then

Set doc = view.getfirstdocument

Do While Not doc is nothing

Set newdatetime = New Notesdatetime ( doc.lastModified )

Set newdatetime = New Notesdatetime ( newdatetime.DateOnly )

if datetime.TimeDifferenceDouble ( newdatetime ) => 0 then

Call doc.copytodatabase ( archivedb )

Call collection.AddDocument ( doc )

End if

Set doc = collection.getnextdocument ( doc )

Loop

End If

Next

'- - clear the collection

Call collection.removeall ( true )

Subject: Archiving agent script

Thank you for your help with this script. I really appreciate it and am going through it to try to understand how it works. Thanks again. Bob