
OpenNTF Code Bin
About This Code
Brief Description:
Archiving - CopyToDatabase method with child documents
Contributor:
Andrew Jones
Last Modified:
17 Jun 2002
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
(Declarations)
Dim ns As NotesSession
Dim ndb As NotesDatabase
Dim ArchiveDb as NotesDatabase
Dim collection As NotesDocumentCollection
Dim kidDocs as NotesDocumentCollection
Dim kid as NotesDocument
Dim parent As NotesDocument
Dim switchDoc As NotesDocument
Sub Initialize
Set ns = New NotesSession
Set ndb = ns.CurrentDatabase
Set ArchiveDb = ns.GetDatabase('your code here')
Set collection = ndb.UnprocessedDocuments
Set parent = collection.GetFirstDocument
If ArchiveDb.Title = "" Then
Msgbox("Couldn't find the Archive Database. Please contact the Notes Admins.")
ExitSub
End If
Do Until parent is Nothing
Call parent.CopyToDatabase(ArchiveDb)
Set kidDocs = parent.Responses
Set kid = kidDocs.GetFirstDocument
Do Until kid is Nothing
Call kid.CopyToDatabase(ArchiveDb)
Set switchDoc = kid
Set kid = kidDocs.GetNextDocument(kid)
Call switchDoc.Remove(True)
Loop
Set switchDoc = parent
Set parent = collection.GetNextDocument(parent)
Call switchDoc.Remove(True)
Loop
End Sub
Usage / Example
Comments
Posted by Patrick Kwintensson on 05/30/2008 06:53:01 AMThanks!
I was just looking for such a method. Googling worked faster than opening the designer help and start searching =)