How To Change Design Of User's Mail Folders

In the user's mailfile, the design of the folder is based on the design of the
view ($All) . But once the folder is created, the design will remain unchanged
even if there is a design change in the view ($All).

In order to let the update the folder design in all user's mailfile, a
lotusScript agent can be created and scheduled to run on the server over the
weekend, or alternatively, let the users runs the agent at their own free time.

The following is the code for the agent. Note that there are a few standard
folders that you should not change the design.
Sub Initialize
Dim Session As New NotesSession
Dim Currentdb As NotesDatabase
Dim newfolder As String
Dim tempfolder As NotesView
Dim doc As NotesDocument

Set Currentdb = Session.CurrentDatabase

'Create new folder for each existing folder and copy all mails from existing
folders to
'new folder
Forall view In currentdb.views
If view.IsFolder And view.name <>"($Inbox)" And view.name <>"($Trash)" And _
view.name <> "$Alarms" And Right(view.name, 6) <> "(New!)" Then
newfolder = view.name & "(New!)"
Set doc = view.GetFirstDocument
Do While Not doc Is Nothing
Call doc.PutInFolder(newfolder)
Set doc = view.GetNextDocument(doc)
Loop
End If
End Forall

'Remove existing folder if there is a corresponding new 'folder
Forall view In currentdb.views
If view.IsFolder And Right(view.name, 6)= "(New!)" Then
Set tempfolder = currentdb.GetView(Left(view.name, Len(view.name)-6))
If Not tempfolder Is Nothing Then
Call tempfolder.remove
End If
End If
End Forall

Forall view In currentdb.views
If view.IsFolder And Right(view.name, 6)= "(New!)" Then
Set doc = view.GetFirstDocument
Do While Not doc Is Nothing
Call doc.PutInFolder(Left(view.name,Len(view.name)-6))
Set doc = view.GetNextDocument(doc)
Loop
Call view.remove
End If
End Forall
End Sub

This was first published in November 2000

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.