I am trying to take an incoming email and save a copy in a folder in a second mail database. I have code which looks like it should work. It does get saved in second database, but not in the folder. I also tried to add an item to the copy. The item gets saved in the original, but not the copy. This agent runs before new mail arrives. Any ideas what is going wrong?
Dim session As New NotesSession
Dim db As NotesDatabase
Dim doc As NotesDocument
Dim db2 As NotesDatabase
Dim destDoc As NotesDocument
Set db = session.CurrentDatabase
Set doc=session.DocumentContext
Set db2 = New NotesDatabase("mailserver", "mail\seconddatabase.nsf")
Call doc.AppendItemValue("SecondaryDomain", "domanname.net")
Set destDoc = doc.CopyToDatabase(db2)
Call destDoc.AppendItemValue("SecondaryDomain", "domanname.net")
Call destDoc.PutInFolder("Folders\domanname.net", True)
Call destDoc.Save(True, False)
Call doc.Save(True, False)