LOTUSSCRIPT/COM/OLE CLASSES
Sub Click(Source As Button) Dim workspace As New NotesUIWorkspace Dim uidoc As NotesUIDocument Dim doc As NotesDocument Dim choice As String Set uidoc = workspace.CurrentDocument Set doc = uidoc.Document choice = Inputbox( "Please enter a folder name:", _ "Which folder?" ) Call doc.PutInFolder( choice ) Call PutAllResponsesInFolder( doc, choice ) End Sub
The PutAllResponsesInFolder sub takes a parent document and a folder name, and places the responses and responses-to-responses of the parent document into the specified folder. The sub places each response to the parent document into the specified folder. For each response, the sub calls itself to place any responses to the response into the folder. This recursive behavior allows you to access every descendant of the parent document, no matter how many levels deep it is nested. If there are no responses, the sub exits.
Sub PutAllResponsesInFolder _ ( doc As NotesDocument, folderName As String ) Dim collection As NotesDocumentCollection Dim currentResponse As NotesDocument Set collection = doc.Responses Set currentResponse = collection.GetFirstDocument ' Put immediate responses to doc into the folder ' If there are none, sub exits and returns to calling sub While Not ( currentResponse Is Nothing ) Call currentResponse.PutInFolder( folderName ) ' Recursive call to put immediate responses to ' currentResponse in folder Call PutAllResponsesInFolder _ ( currentResponse, folderName ) Set currentResponse = collection.GetNextDocument _ ( currentResponse ) Wend End Sub
See Also