I am looking for a way in script to get a handle on a folder in one database and copying it and its contents to another database. Anyone have any ideas as to how to do this? Any help would be appreciated.
Subject: Copy a folder and its contents to another using script?
maybe
Function RenameFolder(SrcFolder,NewFolder,Srcdb)
Dim vue As NotesView
Dim doc As notesdocument
Dim cpt As Integer
cpt = 0
Set vue = db.GetView(Target)
Set doc = vue.GetFirstDocument
Print "Move documents..." + Now
While Not (doc Is Nothing)
cpt = cpt + 1
Call doc.PutInFolder(apres,True)
Call doc.RemoveFromFolder( Target )
Set doc = vue.GetFirstDocument
Wend
If cpt > 0 Then
Print Str(cpt) & " documents ..." + Now
End If
Call vue.Remove
End Function
Subject: Copy a folder and its contents to another using script?
Thanks…but it looks like what you posted would copy the folder and its contents to another folder within the same database. I am looking for code to copy a folder and it’s contents to a different db.
Subject: RE: Copy a folder and its contents to another using script?
Another example
Dim s As New NotesSession
Dim sdb As NotesDatabase
Dim tdb As NotesDatabase
Dim doc As NotesDocument
Dim tdoc As NotesDocument
Dim entrycoll As NotesViewEntryCollection
Set sdb = s.GetDatabase("Source Server","Source Database",False)
Set tdb = s.GetDatabase("Target Server","Target Database",False)
viewcoll = sdb.Views
Forall v In viewcoll
If Instr(Lcase(v.Name),Lcase("Name of Folder"))<>0 Then
Set entrycoll = v.AllEntries
Set e = entrycoll.GetFirstEntry
While Not e Is Nothing
Set tdoc = e.Document.CopyToDatabase(tdb)
tdoc.PutInFolder v.Name,True
Set e = entrycoll.GetNextEntry(e)
Wend
End If
End Forall
Andreas Hoster