Tip

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
Agent:

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
%REM
$Archived and DateArchived might already be present, if this agent failed the
last
time it was run.? None of these fields should be on the archived copy, because
we
don't want the archive database to inadvertantly archive these documents (it
can
archive, but it needs to use its own criteria)
%END REM
?
???? If docSource.HasItem("$Archived") Then docSource.RemoveItem("$Archived")
???? If docSource.HasItem("DateArchived") Then
docSource.RemoveItem("DateArchived")
???? 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

This was first published in November 2000

There are Comments. Add yours.

 
TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

Disclaimer: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.