Examples: Import method (NotesDXLImporter - LotusScript®)
This Visual Basic example imports DXL into a newly created database.
Private Sub Import_Click()
Dim session As New NotesSession
Dim dbdir As NotesDbDirectory
Dim db As NotesDatabase
Dim stream As NotesStream
Dim importer As NotesDXLImporter
Call session.Initialize
Rem Open file
Set stream = session.CreateStream
Rem If Not stream.Open("c:\dxl\names.dxl") Then
If Not stream.Open("c:\dxl\exporteddb.dxl") Then
MsgBox "Cannot open names.dxl", , "Error"
Exit Sub
End If
If stream.Bytes = 0 Then
MsgBox "File did not exist or was empty", , FileName$
Exit Sub
End If
Rem Create new database
Set dbdir = session.GetDbDirectory("")
Set db = dbdir.CreateDatabase("names2", True)
Rem Import DXL into new database
Set importer = session.CreateDXLImporter
importer.ReplaceDBProperties = True
importer.ReplicaRequiredForReplaceOrUpdate = False
importer.ACLImportOption = DXLIMPORTOPTION_REPLACE_ELSE_IGNORE
importer.DesignImportOption = DXLIMPORTOPTION_CREATE
Call importer.Import(stream, db)
Call stream.Close
End Sub