Protect Users Mail Folders Before Major Design Change

If you are upgrading your user's mail templates to include new features or
simply an upgrade of notes, they can easily lose folders that for one reason or
another do not have the "Do Not Allow design Refresh/Replace to Modify" option
set in the design properties

This is accomplished by treating the Folder like a NotesDocument Class item and
then modifying the $Flags field
Dim s As New NotesSession
Dim db As NotesDatabase
Dim uniqid As String
Dim count As Integer
Dim emaildbs As String

Set db = s.CurrentDatabase

dbdir = Inputbox("What directory do you want to run this against?" ,
"Directory", "mail")
dbfile = Inputbox$("What file do you want to run this against? (blank for
whole dir)" , "File", "")
If dbdir = "" Then
Exit Sub
End If

If dbfile <> "" Then
emaildbs = dbfile
emaildbs = Dir$("f:\notes\data\" & dbdir & "\*.nsf")
End If
While emaildbs <> ""
dbname = dbdir & "\" & emaildbs
count = 0
Dim om As New NotesDatabase("","")
If Not(om.Open(db.Server, dbname)) Then
Msgbox "Could not open a mail database....Exiting!"
Exit Sub
End If

Forall Views In om.Views
If Views.IsFolder Then
count = count + 1
uniqid = Views.UniversalID
Set doc = om.GetDocumentByUNID(uniqid) 'This line treats
the folder like a NotesDocument to access the field called $Flags
Set flags = doc.GetFirstItem("$Flags")
If Not (flags.Text Like "*P*") Then
flags.Values = flags.Text & "P"
Call doc.Save(True, False)
entrytext = Views.Name & " in " & emaildbs & " has
been protected!"
Print entrytext
entrytext = Views.Name & " in " & emaildbs & " is
already protected!"
Print entrytext
End If
End If
End Forall
'entrytext = "In " & emaildbs & " database, " & count & " folders
have been processed!"
'Msgbox entrytext
If (dbfile <> "") Then
emaildbs = ""
emaildbs = Dir$()
End If
End Sub
This was first published in November 2000
This Content Component encountered an error



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:




  • iSeries tutorials'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 ...