A Fix For Lotus' Archive Utility In Stdmail

A Fix for Lotus' Archive Utility in StdMail (version 4.5x and 4.6x compliant) -
this script change will allow you to Archive Messages and put them in the same
folder that they were in in the original working mail file. If the folder does
not already exist in the archive, the script will create it on the fly
(PutInFolder method).

Add this script to the 2 Archive Agents (1 is manual, the other is scheduled)
to save doc in correct folder.

To use the following code in the Periodic Archive Agent, change note to
docSource and newnote to docArchive.
Put this code in the Archive Document EVENT of the Arichve Selected docs Agent.

'put archived doc in folder from which it came
Dim parentView As NotesView
Set parentView = note.ParentView
If parentView.IsFolder Then
Call newnote.PutInFolder( parentView.Name )
End If

A revised code for this tips is as follows:
The Periodic Archive Agent will not find the ParentView, given that the
documents to be archived are gathered using a NotesDocumentCollection rather
than picked up from the View or Folder that the document resides in.? I wrote
some code that will gather the docs based upon their View, rather than 1 big
lump of documents using the AllDocuments property.? It involves making changes
to 2 Events - ProcessDocuments and ArchiveDocuments in the Periodic Archive

Sub ProcessDocuments
???? 'get a handle to all Views in the database
???? Dim docNext As Notesdocument
???? Forall x In dbSource.Views
????????? 'skip these views - they'll make redundant entries
????????? If x.Name <> "($All)"?? And? x.Name <> "Discussion Threads"?? And?
x.Name <> "_Archiving"_
????????? And x.Name <> "($Meetings)"??? And x.Name <> "($POP3)" And x.Name <>
"($FolderInfo)"? And x.Name <> "($VIM100)" And x.Name <> "($VIM23)" _
????????? And x.Name <> "($VIM256)" And x.Name <> "($VIM42)" And x.Name <>
"($VIM98)" Then
?????????????? Set docSource = x.GetFirstDocument( )
????????????? 'get a handle to all docs in this view
?????????????? While Not (docSource Is Nothing)
??????????????????? 'Next
??????????????????? Set docNext = x.GetNextDocument( docSource )
?????????????????? 'see if this document can be archived
??????????????????? EvaluateDocument
??????????????????? If DocCanBeArchived Then
???????????????????????? 'archive this document
???????????????????????? ArchiveDocument
???????????????????????? If ArchiveLog = "Yes" Then AddDocumentToLog
???????????????????????? docSource.Remove True
??????????????????? End If
??????????????????? 'see if we have hit the maximum number of entries in a log
document; if so close the existing one and create a new one
??????????????????? If (numDocsArchived Mod MAXARCHIVEITEMS = 0) And
(numDocsArchived > 0) Then
???????????????????????? If ArchiveLog = "Yes" Then
????????????????????????????? CloseLogDocument
????????????????????????????? CreateLogDocument
???????????????????????? End If
??????????????????? End If
??????????????????? Set docSource = docNext
?????????????? Wend
????????? End If
???? End Forall
???? 'we are done processing all of the documents, close the last log document
(if necessary)
???? If ArchiveLog = "Yes" Then CloseLogDocument
End Sub

Sub ArchiveDocument
???? 'copies the source document into the archive database
$Archived and DateArchived might already be present, if this agent failed the
time it was run.? None of these fields should be on the archived copy, because
don't want the archive database to inadvertantly archive these documents (it
archive, but it needs to use its own criteria)
???? If docSource.HasItem("$Archived") Then docSource.RemoveItem("$Archived")
???? If docSource.HasItem("DateArchived") Then
???? If docSource.HasItem("ExpireDate") Then docSource.RemoveItem("ExpireDate")
???? FixReaderNames
???? docSource.Save True, True
???? Set docArchive = docSource.CopyToDatabase(dbArchive)
???? 'put archived doc in folder from which it came
???? Dim parentView As NotesView
???? Set parentView = docSource.ParentView
???? If parentView.IsFolder Then
????????? Call docArchive.PutInFolder( parentView.Name )
???? End If
???? docSource.DateArchived = dtNow.LSLocalTime
???? Call docSource.Appe

Dig Deeper on Domino Resources - Part 2

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.




  • 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 ...