I have two documents; document1 allows read/write, but document2 is readonly.
var document1:NotesView = database.getView("viewDoc1");
var document2:NotesView = database.getView("viewDoc2");
//var copiedDoc:NotesDocument=document2.CopyToDatabase(document1);
docEv:NotesDocument = document1.getDocumentByKey("userName");
if(docEv!=""){...}else{...};
beforePageLoad
Before page is rendered, I want to be able copy all data in the readonly document and save it into the read/write document and also check if documents already exist in the read/write, in which case don't copy. Your help will be appreciated.
This line of your code makes no sense:
First of all, you said that you want to copy document2 into document1, but you appear to be trying to copy it into a new, third NotesDocument called copiedDoc.
But more importantly, you're passing document1 as the argument into the CopyToDatabase method, but that method takes a NotesDatbase argument, not a NotesDocument argument!
You may want to look at the CopyAllItems method instead.