hcl-bot
February 15, 2008, 6:47am
1
Can’t get copytodatabase to work, any ideas what is wrong with this code?
Dim session As New NotesSession
Dim db As NotesDatabase
Dim db2 As New NotesDatabase(“”,“”)
Dim doc As NotesDocument
Set db = session.CurrentDatabase
Set doc = session.DocumentContext
Call db2.Open(db.Server,“directory\directory\filename.nsf”)
If db2.IsOpen Then
Print “DB2 opened OK…” - Works OK
Print db2.FilePath - Works OK
Print doc.Subject(0) - Works OK
Call doc.CopyToDatabase(db2) - FAILS, not copied, nothing written to log
Print “Doc copied OK…” - FAILS, Not printed
End If
End Sub
Running agent as web user(Manual/Hidden, trigger on event;agent list selection), user has full rights to both DBs, Agent triggered from wqs even on web form.
hcl-bot
February 15, 2008, 6:51am
2
Subject: CopyToDatabase script not working
Hi
DocumentContext gives you the in-memory document.
Your problem is that you trying to copy a document which is not yet in the database. Call doc.save first before copying it.
brgds Jesper Kiaer
http://www.jezzper.com
hcl-bot
February 15, 2008, 10:10am
3
Subject: RE: CopyToDatabase script not working
Added a save before the copy, no effect.
Got round it by creating a new doc in db2 using CopyAllItems, worked first time. Don’t think CopytoDatabase likes DocumentContext !!
hcl-bot
February 15, 2008, 4:36pm
4
Subject: RE: CopyToDatabase script not working
may be agent signer does not have “replicate or copy docs” privilege