OpenNTF.org - Agent to remove all empty fold
My Links (Not logged in)
Code Bin Search
 
Hosted by Prominic.NET
Rate This Code
5 - brilliant stuff
4 - very nice
3 - average
2 - needs work
1 - bad
   OpenNTF Code Bin
About This Code
Brief Description:
Agent to remove all empty folders 
Rating:
Not Rated Yet 
Contributor:
David C Slatter 
Category:
Lotusscript 
Type:
Email 
Document Release:
1.0 
Notes Version:
R6.x, R7.x 
Last Modified:
24 Apr 2007 
OpenNTF Disclaimer

All of the program code and information presented in the OpenNTF.org Code Bin are provided "as-is", and should be used at your own risk. OpenNTF.org make no express or implied warranty about anything in the Code Bin, and OpenNTF.org will not be responsible or liable for any damage caused by the use or misuse of anything from this site. OpenNTF.org makes no guarantees about anything. Please thoroughly test all of the knowledge and code you find here before you attempt to use them in your production environment.

Code / Description
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

Usage / Example
 Comments

No documents found

 Add your comment!