Recover lost folders

This tip shows you how to recover lost files using a LotusScript agent.

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.

This was first published in February 2005

Dig deeper on LotusScript

0 comments

Oldest 

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:

SearchWinIT

Search400

  • iSeries tutorials

    Search400.com'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 ...

SearchEnterpriseLinux

SearchVirtualDataCentre.co.UK

Close