Tip

Recover lost folders

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

There are Comments. Add yours.

 
TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

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:

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.