Das Notes Forum

Domino 9 und frühere Versionen => ND6: Entwicklung => Thema gestartet von: RvM am 06.07.06 - 09:13:31

Titel: Fehler im Script
Beitrag von: RvM am 06.07.06 - 09:13:31
 ???
Ich möchte gerne von einem vorhandenem Dokument eine Kopie erstellen. dazu habe ich folgendes Script einem Button zugewiesen:
Sub Click(Source As Button)
   Dim ws As New NotesUIWorkspace
   Dim s As New NotesSession
   Dim db As NotesDatabase
   Dim v As NotesUIDatabase
   Dim oldDoc As NotesDocument
   Dim newDoc As NotesDocument
   Dim thisDoc As NotesUIDocument
   Set ws = New NotesUIWorkspace
   Set v = ws.CurrentDatabase
   
   Set db = s.CurrentDatabase
   Set thisDoc = ws.CurrentDocument
   Set oldDoc = ws.CurrentDocument.Document
   Set newDoc = OldDoc.CopyToDatabase(db)

Bei der letzten Zeile wird mit der Fehlermeldung: "Invalid universal ID" abgebrochen. Was mich nun irritiert ist, das dieses Script in einer anderen Anwendung, die eine Kopie dieser Anwendung ist, einwandfrei funktioniert.
Was ist da falsch dran?
Titel: Re: Fehler im Script
Beitrag von: Glombi am 06.07.06 - 09:19:14
Ist das aktuelle Dokument bereits gespeichert?

Falls nicht, würde ich dann noch folgendes machen:


Set db = s.CurrentDatabase
   Set thisDoc = ws.CurrentDocument
if thisDoc.IsNewDoc then
call thisDoc.Save
end if


   Set oldDoc = ws.CurrentDocument.Document
   Set newDoc = OldDoc.CopyToDatabase(db)
Titel: Re: Fehler im Script
Beitrag von: RvM am 06.07.06 - 10:45:43
 ;)
Jepp - das war's
DANKE!