You know the situation. CONVERT task has deleted some of private folders in the mail database because of a missing flag, "Prohibit design refresh." How do you recover them easily? It simple, the provided LotusScript coded agent will restore them, comparing the list of private folders in the stricken server (current) database and its local replica -- backup of the database.
Code: Sub Initialize Dim ss As New NotesSession Dim uiw As New NotesUIWorkspace Dim cdb As NotesDatabase Dim replika As New NotesDatabase("", "") Dim doc As NotesDocument Dim coll As NotesViewEntryCollection Dim ventry As NotesViewEntry Dim cfolder As String Dim cview As NotesView Dim slozka List As Integer Dim n As Integer Set cdb = ss.CurrentDatabase If Not replika.OpenByReplicaID( "", cdb.ReplicaID) Then Messagebox "Local replica was not found!" Exit Sub End If n = 1 ' List of existing folders Forall s In cdb.Views If s.isfolder Then If Left$(s.name, 1) <> "(" Then slozka(s.name)=n n = n + 1 End If End If End Forall ' List of folders in local replica Forall s In replika.Views If s.isfolder Then If Left$(s.name, 1) <> "(" Then If Iselement(slozka(s.name)) Then Else ' lost folder Set coll = s.AllEntries Print "Restore: " & s.name, Cstr (coll.Count) & " documents." If coll.Count > 0 Then Call cdb.EnableFolder( s.name) Set ventry = coll.getFirstEntry While Not ventry Is Nothing If ventry.IsDocument Then Set doc = cdb.getdocumentbyunid( ventry.UniversalID) If Not doc Is Nothing Then Call doc.PutInFolder( s.name) End If End If Set ventry = coll.GetNextEntry( ventry) Wend End If End If End If End If End Forall End Sub
Do you have comments on this tip? Let us know.
This tip was submitted to the SearchDomino.com tip exchange by member Milos Safarik. Please let others know how useful it is via the rating scale below. Do you have a useful Notes/Domino tip or code to share? Submit it to our monthly tip contest and you could win a prize and a spot in our Hall of Fame.