Domino 9 und frühere Versionen > ND8: Entwicklung

Konfilkt-Dokument

(1/1)

Hedwig14:
Hallo,
in einem Frontend Dokument habe ich folgenden Schalter eingebaut um aus einem anderen Backend-Dokument einen Dateianhang zu kopieren. Das klappt auch alles ganz gut. Leider bekomme ich beim nachträglichen Speichern die Frage, ob eine Konflikt-Dokument angelegt werden soll !

Was ist falsch in meinem Code:

Sub Click(Source As Button)
   Dim ses As New NotesSession
   Dim ws As New NotesUIWorkspace
   Dim db As NotesDatabase
   Dim collection As NotesDocumentCollection
   Dim uidoc As NotesUIDocument
   
   Dim docWork As NotesDocument
   Dim docMaster As NotesDocument
   
   Dim itemWork As NotesItem
   Dim itemMaster As NotesItem
   
   Dim masterID As Variant
   Dim workID As String
   
   Set db = ses.CurrentDatabase
   Set uidoc = ws.CurrentDocument
   
   Set docWork = uidoc.Document
   workID = docWork.UniversalID   
   uidoc.Save
   Call uidoc.Close(True)
   
   'Quell-Dokument auswählen
   Set collection = ws.PickListCollection(PICKLIST_CUSTOM, True, db.Server, db.FilePath, "Archiv\IGKnach Kunde", "Auswahl", "Bitte wählen Sie das Paket aus:" )
   Set docMaster = collection.GetfirstDocument
   Set itemMaster = docMaster.GetFirstItem( "tabelle" )
   
   Set docWork = Nothing
   Set docWork = db.GetDocumentByUNID(workID)
   
   'Kopieren
   Call docWork.RemoveItem("tabelle")
   Call itemMaster.CopyItemToDocument( docWork, "tabelle" )
   Call docWork.Save(True, False, False)
   
   'Zum weiteren Bearbeiten wieder öffnen
   Set uidoc = ws.EditDocument (True, docWork)
   
End Sub

Axel:
Du hast ein Dokument im Frontend speicherst es und versuchst es zu schließen um dann im Backend nach Kopieren des Anhangs es wieder zu speichern. Vermutlich ist das Dokument noch nicht sauber geschlossen.

Versuch's mal so (allerdings habe ich es so nicht getestet):

   ...
   Set docWork = uidoc.Document
   
   'Quell-Dokument auswählen
   Set collection = ws.PickListCollection(PICKLIST_CUSTOM, True, db.Server, db.FilePath, "Archiv\IGKnach Kunde", "Auswahl", "Bitte wählen Sie das Paket aus:" )
   Set docMaster = collection.GetfirstDocument
   Set itemMaster = docMaster.GetFirstItem( "tabelle" )
   
   'Kopieren
   Call docWork.RemoveItem("tabelle")
   Call itemMaster.CopyItemToDocument( docWork, "tabelle" )

    'Reopen damit den Anhang sichtbar wird
    Call Reopen(docWork)

     'Weitere Anweisungen
     ....


Reopen-Funktion

--- Code: --- REM Das aktuelle Dokument schließen und wieder öffnen......
    Function ReOpen(docThis As NotesDocument) As Integer
        Dim ws As New NotesUIWorkspace
        Dim uidoc As NotesUIDocument
        Dim dbThis As NotesDatabase
        Dim unid As String
 
        ReOpen = 0
        Set dbThis = docThis.ParentDatabase
        Call docThis.Save(True , True)
        unid = docThis.UniversalID
        docThis.SaveOptions = "0" ' # ... Speicherabfrage vermeiden
        Set uidoc = ws.CurrentDocument
        Call uidoc.Close
        Set docThis = dbThis.GetDocumentByUNID(unid)
        Set uidoc = ws.EditDocument(True , docThis)
        Set docThis = uidoc.Document
        If docThis.HasItem("SaveOptions") Then 
            ' # ... das Feld SaveOptions wieder entfernen...
            docThis.RemoveItem("SaveOptions")
            Call docThis.Save( True , True )
        End If
        ReOpen = 1
        Print "Das Dokument wurde erneut geöffnet"
    End Function

--- Ende Code ---

Hedwig14:
SUPER ! Danke !
Das hat geklappt !!!!

Viele Grüße

Navigation

[0] Themen-Index

Zur normalen Ansicht wechseln