Agent "Rebuild Folders in this Database" - updates folders to new design by deleting folders and creating replacements. Documents are placed back in the folders using a unique ID within the folder names. 
 
 
This sectioon in Options section: 
Option Public 
Option Explicit 
 
This section in initialize: 
Sub Initialize 
		 Dim session As New NotesSession 
		 Dim db As NotesDatabase 
		 Dim vc As NotesViewEntryCollection 
		 Dim view As NotesView		 		 		 		 		 ' Represents 
the current view/folder in the database being evaluated 
		 Dim indexview As NotesView		 		 		 ' The BinderIndex 
view that has all the docs sorted by which folder they should be in 
		 Dim dc As NotesDocumentCollection		 ' Collection of Docs from 
BinderIndex view to put in new folder 
		 Dim dcdoc As NotesDocument		 		 		 ' The docs in the 
index view that will be put in the new folder 
		 Dim vName As String     		 		 		 		 		 ' 
The main name of the view 
		 Dim v1stAlias As String  		 		 		 		 		 ' 
1st alias of the folder - needed to do lookup to the BinderIndex view 
		 Dim vAliases As String   		 		 		 		 		 ' 
All The aliases of the view/folder 
		 Dim foldername As String		 		 		 		 ' The string 
concatenation of the full name of the old/new folder 
		 Set db = session.CurrentDatabase 
		  
		  
		 ' Loop throug all the views & folders 
		 Forall v In db.Views 
		 		 Set view = v 
		 		  
		 		 ' If the view is a folder do our stuff else move on 
		 		 If ( view.IsFolder ) Then 
		 		 		 vName = view.Name 
		 		 		 vAliases = "" 
		 		 		 v1stAlias = view.Aliases(0) 
		 		 		 If vName = "(Default Binder)" Then  
		 		 		 		 Goto Skip		 		  
		 		 		 End If 
		 		 		 ' Build aliase string to append to the vName 
		 		 		 If Not Isempty(view.Aliases) Then 
		 		 		 		 Forall aliass In view.Aliases 
		 		 		 		 		 vAliases = vAliases & "|" & aliass 
		 		 		 		 End Forall 
		 		 		 End If 
		 		 		  
		 		 		 ' Remove any documents 
		 		 		 Set vc = view.AllEntries 
		 		 		 Call vc.RemoveAllFromFolder(vName) 
		 		 		 ' Kill the existing folder 
		 		 		 Call view.Remove 
		 		 		 ' Create the Replacement Folder &  
		 		 		 ' Get the docs back into the folder using the 
binderindex view. Skip any response/working docs 
		 		 		 foldername = vName & vAliases 
		 		 		 Messagebox(  foldername ) 
		 		 		 Set indexview = db.GetView("(BinderIndex)") 
		 		 		 Set dc = indexview.GetAllDocumentsByKey(v1stAlias) 
		 		 		 Call dc.PutAllInFolder(foldername) 
             		 		 ' Here is section where we don't put Response docs 
in this folder - is this bad to do? 
		 		 		 ' We are no longer using this section due to the 
multiple folder problem. Using code above instead. 
		 		 		 ' Set dcdoc = dc.GetFirstDocument 
		 		 		 ' While Not(dcdoc Is Nothing)       
		 		 		 ' 		 If Not(dcdoc.IsResponse) Then 
		 		 		 ' 		 		 Call dcdoc.PutInFolder(foldername) 
		 		 		 ' 		 End If 
		 		 		 ' 		 Set dcdoc = dc.GetNextDocument(dcdoc) 
		 		 		 ' Wend  
		 		 End If		  
Skip:		 		  
		 End Forall		  
End Sub
  
previous page
 
  |