Examples: DocumentImportOption property

This agent imports DXL from a file into an existing database. The agent replaces the documents in the database with the documents from the incoming DXL.

Sub Initialize
  Dim session As New NotesSession
  Dim db As NotesDatabase
  Set db = session.CurrentDatabase
  filename$ = Left(db.FileName, Len(db.FileName) - 4)
  
  REM Open xml file named after current database
  Dim stream As NotesStream
  Set stream = session.CreateStream
  If Not stream.Open("c:\dxl\" & filename$ & ".dxl") Then
    Messagebox "Cannot open " & filename$,, "Error"
    Exit Sub
  End If
  If stream.Bytes = 0 Then
    Messagebox "File did not exist or was empty",, filename$
    Exit Sub
  End If
  
  REM Replace documents in this database with matching ones in the DXL
  Dim importer As NotesDXLImporter
  Set importer = session.CreateDXLImporter(stream, dbCopy)
  importer.DocumentImportOption = DXLIMPORTOPTION_REPLACE_ELSE_IGNORE
  Call importer.Process
End Sub