Domino 9 und frühere Versionen > Entwicklung

CopyAllItems

(1/2) > >>

Sese:
Hallo zusammen.

Ich habe probleme mit einer Funktion.

Ich will über eine Aktion in einem Dokument eine Kopie dieses Dokumentes erstellen. Das ganze sollte geschehen, ohne das orignial im Edit-Modus zu öffnen (bzw. im Backend-Bereich).

Ich habe in der Notes-Hilfe folgende Code gefunden:


--- Code: ---Dim session As New NotesSession
Dim db As NotesDatabase
Dim docA As NotesDocument
Dim docB As NotesDocument
Set db = session.CurrentDatabase
'...set value of docA...
Set docB = New NotesDocument( db )
Call docA.CopyAllItems( docB, True )
Call docB.Save( True, True )
--- Ende Code ---

Dieser funktioniert jedoch nicht.

Hat jemand eine Idee, wie ich das lösen kann ?

Vielen Dank im voraus.

Gruß
Sebastian

ata:
... wo initialisierst du das docA ?

ata

Sese:

--- Zitat von: ata am 30.05.03 - 10:24:31 ---... wo initialisierst du das docA ?

--- Ende Zitat ---

?? Ich glaube, daß genau da mein Problem liegt, bzw. ich nicht weiß wie ??

Ich habe den Code direkt aus er Notes-Hilfe übernommen. Der Degugger sagt auch, daß er docA nicht findet !

Wie müsste ich docA denn initialisieren ?

Danke .

Gruß
SESE

klaussal:
... als BEiSPIEL !:

--- Code: ---Sub Click(Source As Button)
   Dim session As New NotesSession
   Dim db As NotesDatabase
   Dim ws As New NotesUIWorkspace
   Dim uidoc As NotesUIDocument
   Dim doc As NotesDocument
   Dim notesDate As New NotesDateTime ("")
   Dim docNew As NotesDocument
   Dim rtitem As NotesRichTextItem
   Dim varDummy As Variant
   
   Set db = session.currentDatabase
   Set uidoc = ws.currentDocument
   Set doc = uidoc.document
   
   
   varDummy = ws.Prompt( PROMPT_YESNO, "Schliessen", "Sie wollen eine neue Insolvenz öffnen. " _
   & Chr(13) & "Möchten Sie wirklich fortfahren ? "_
   & Chr(13) + "Danach kann das Dokument nicht mehr bearbeitet werden !!!")
   If Not Cstr(varDummy) = "1" Then
      Exit Sub
   End If
   
   If Trim(doc.name(0)) = "" Or Trim(doc.strasse(0)) = ""  Or Trim(doc.plz(0)) = ""  Or Trim(doc.ort(0)) = "" Then
      Msgbox "Einige Felder sind noch nicht ausgefüllt. " _
      & Chr(13) + "Aktion wird abgebrochen !"
      Exit Sub
   End If
   
   Call notesDate.setNow
   doc.akte_ende = notesDate.dateOnly
   Call doc.save(True, False)
   Call uidoc.close
   
   Set docNew = db.createDocument
   docNew.Form = "maske_insolvenz"
   docNew.name = doc.name(0)
   docNew.HRB = doc.HRB(0)
   docNew.strasse = doc.strasse(0)
   docNew.plz = doc.plz(0)
   docNew.ort = doc.ort(0)
   docNew.akte_beginn = notesDate.dateOnly
   
   Set rtitem = New NotesRichTextItem( docNew, "sonstiges" )
   Call rtitem.AppendDocLink( doc, "Link zur AGS" )
   Call docNew.save(True, True)
   Set uidoc = ws.EditDocument(True, docNew)
End Sub

--- Ende Code ---

Axel:
Hi,

versuch's doch mal so:


--- Zitat ---Dim session As New NotesSession
Dim db As NotesDatabase
Dim docA As NotesDocument
Dim docB As NotesDocument
Dim collection As NotesDocumentCollection

Set db = session.CurrentDatabase
'...set value of docA...
Set collection = db.UnprocessedDocuments

Set docA = collection.GetFirstDocument
While Not (docA Is Nothing)
  Set docB = New NotesDocument( db )
  Call docA.CopyAllItems( docB, True )
  Call docB.Save( True, True )
  Set docA = collection.GetNextDocument(docA)
Wend


--- Ende Zitat ---

Damit werden alle markierten Dokumente in der Ansicht, in der die Aktion enthalten ist, dupliziert.


Axel

Navigation

[0] Themen-Index

[#] Nächste Seite

Zur normalen Ansicht wechseln