OpenNTF Mail Experience - Feature Request: Agent to remove all empty folders.
Sub Initialize
Dim session As New NotesSession
Dim ws As New NotesUIWorkspace
Dim askme As Variant
Dim vc As NotesViewEntryCollection
Dim db As NotesDatabase
Dim view As notesview
Dim views As Variant
Dim x As Long
Dim msg As String
Dim Entrycount As Long
Print msg & "Looking For Empty Folders "
Set db = session.CurrentDatabase
views = db.Views
msg = "FOUND " & Cstr(0) & " - "
x = 0
Forall v In views
If Not ( Left(v.name,1) = "(" Or Left(v.name,1) = "$" ) Then
Set vc = v.Allentries
Entrycount = vc.Count
If v.Isfolder And Entrycount = 0 Then
Redim Preserve viewarray(x) As String
viewarray(x) = v.Name
x = x +1
msg = "FOUND " & Cstr(x) & " - " & v.Name
End If
Print msg & " looking at " & v.Name
End If
End Forall
askme = ws.Prompt(PROMPT_OKCANCELLISTMULT, _
"Un Select all the Folders you want to Keep", _
"Un Select All of the empty Folders you want to Keep.", _
viewarray,viewarray)
If Isempty(askme) Then
Messagebox "User canceled or No empty folders found ", , "No folders selected"
Else
Forall ask In askme
Set view = db.GetView(ask)
If Not ( view Is Nothing) Then
Call view.Remove
End If
End Forall
Messagebox "Folders have been removed. Close and reopen the datebase to see the changes.", , "Folders Deleted"
End If
End Sub
Taken Actions by OwnersOwners have rejected the request.