Domino 9 und frühere Versionen > Entwicklung

CopyToDatabase - Fehlermeldung

(1/1)

RvM:
 ???
Erst einmal allen ein gutes neues Jahr!!
Und nun meine Prob:
Ich wollte per Agenten nach dem Abspeichern eines Doks dieses Dok in eine zweite DB kopieren. Dafür setze ich folgenden Agenten, der über eine Aktion aufgerufen wird:

Dim ws As New NotesUIWorkspace
   Dim s As New Notessession
   Dim db As NotesDatabase
   Dim oldDoc As NotesDocument
   Dim newDoc As NotesDocument
   
   Set db = s.GetDatabase("","hstag.nsf")
   Set oldDoc = ws.CurrentDocument.Document
   Set newDoc = oldDoc.CopyToDatabase(db)

Am Ende des Agentendurchlauf bekomme ich die Fehlermeldung, das die DB "hstag.nsf" nicht geöffnet ist.
Wo ist der fehler im Script?

Glombi:
Liegt denn die DB wirklich lokal?

Ob die DB offen ist, würde ich im Code abfragen:

Dim ws As New NotesUIWorkspace
   Dim s As New Notessession
   Dim db As NotesDatabase
   Dim oldDoc As NotesDocument
   Dim newDoc As NotesDocument
   
   Set db = New NotesDatabase("","")
call db.Open("","hstag.nsf")
if db.IsOpen then
   Set oldDoc = ws.CurrentDocument.Document
   Set newDoc = oldDoc.CopyToDatabase(db)
end if

RvM:
Beide DB's liegen auf dem gleichen Server, aber nicht lokal, sondernim Netz.

Driri:
Dann öffne die DB doch einfach vorher mit db.Open.

Du kannst natürlich vorher auch prüfen, ob sie schon geöffnet ist und dann öffnen oder nicht.

8<---Schnipp aus der Designerhilfe :

Opens a database. A database must be open to access all its properties and methods. For details on accessing the properties and methods of a database, see the Usage section in NotesDatabase.

RvM:
 :D
@Glombi:
danke - das wars!!!

Navigation

[0] Themen-Index

Zur normalen Ansicht wechseln