R6.5 upgrade destroys some user folders <SOLUTION>

We ran into this problem, caused by ‘prohibit design refresh’ being unchecked. Here’s some sample code for an agent that can programmatically look at and set this property.

Sub Initialize

On Error Goto handler



Dim session As New NotesSession

Dim db As NotesDatabase

Dim targetdb As NotesDatabase	

Dim view As NotesView



Set db = session.CurrentDatabase



Dim tserver As String

Dim tdb As String

tserver = Inputbox$ ( "Please type the complete server name to access", "Enter Server Fullname" )

tdb = Inputbox$ ( "Please type the complete mailfile path to open", "Enter Mailfile Path" )

Set targetdb = session.GetDatabase(tserver, tdb)	



If Not targetdb.IsOpen Then

	Msgbox "Database not found, try again", 64,"User input error, pay attention y'all."	

	Exit Sub

	

Else

	Msgbox "Database opened ok", 64, "Ready to Process"

End If



Dim doc As notesdocument

Dim logdoc As NotesDocument



Set logdoc = db.CreateDocument

logdoc.form = "Log"

logdoc.title = targetdb.Title	

Dim tcounter, fcounter, gocounter, pcounter As Integer



Forall views In targetdb.Views   ' loop through all views in target

	If views.isfolder Then		' is the view a folder?

		If Not issystemfolder(views.name) Then 	' is the folder a not a system folder?

			If Not views.Isprohibitdesignrefresh Then		' is the non-system folder unprotected?

				gocounter = gocounter+1 	' count

				If logdoc.fnames(0) = "" Then  ' check if this is the first folder

					logdoc.fnames = views.name

				Else

					logdoc.fnames = logdoc.fnames(0) & " - " & views.name

				End If

				views.Isprohibitdesignrefresh = True  ' protect the folder

			End If

			pcounter = pcounter + 1

		End If

		fcounter = fcounter+1

	End If

	tcounter = tcounter+1

End Forall



'write out our counters to the log doc

logdoc.tcount = Cstr(tcounter)

logdoc.fcount = Cstr(fcounter)

logdoc.ucount = Cstr(pcounter)

logdoc.pcount = Cstr(gocounter)

'Msgbox "Total Views - " & Cstr(tcounter) & "| # Folders - " & Cstr(fcounter) & "| User Protected - " & Cstr(pcounter) & "| User Unprotected - " & Cstr(gocounter)

Call logdoc.Save(True,False)



Exit Sub

handler:

Msgbox Error & " on " & Erl

Resume Next

End Sub

Function isSystemFolder(NameFolder As String) As Integer

'//This validates and excludes system's folders

Dim functionName As String



functionName = "ValidateSystemFolder"

On Error Goto TrapError



Let isSystemFolder = False

If  ( Left(NameFolder, 1) = "(" And Right( NameFolder, 1) = ")")_ 

Or ( Left( NameFolder, 1 ) = "$") Or (NameFolder = "Rules") Or (NameFolder = "JunkMail") Then

	Let isSystemFolder = True

End If



Exit Function

TrapError:

Msgbox "Error on " & functionName & "  --> " & (Err & ": " & Error$ & " : " & Erl)

Exit Function

End Function