Sunday, 6 March 2011

Make Private folders Public

Sub Click(Source As Button)
       Dim ws As New NotesUIWorkspace
       Dim session As New NotesSession
       Dim db As NotesDatabase
       Dim view As NotesView
       Dim entries As NotesViewEntryCollection
       Dim str_foldername As String

       ' process thru array of views and folders
       Forall folder In session.CurrentDatabase.Views
              ' identify private view/folder
               If Not Isempty(folder.Readers) And folder.IsFolder Then
                       Set entries = folder.AllEntries
                       If entries.Count = 0 Then
                               Call folder.Remove
                               str_foldername = folder.Name
                               Call entries.PutAllInFolder(str_foldername &"temp", True)
                               Call folder.Remove
                               Set view = session.CurrentDatabase.GetView(str_foldername & "temp")
                               view.Name = str_foldername
                       End If
               End If
       End Forall
       Messagebox "Private folders have been updated.  Your mail file will now be closed so the changes can take affect.", 64, "Update Complete"
       Call ws.CurrentDatabase.Close
End Sub

No comments:

Post a Comment