Am I missing something or does the DXL importer only work for current database and Local databases? I’m attempting to import a copy of the Database Script code to multiple databases - this works fine for a Local replica of a db but doesn’t seem to work for the same database on a server.
I’ve found several code examples that either import to currentdatabase or create a new Local db and import to that.
The Designer help just says that the output for DXL importer is notesdatabase and doesn’t qualify where this can be.
I’ve got an export agent that uses the DBDesign Class from the sandbox to get a handle on the Database Script document and export this to a DXL file - this works fine.
I’ve got an import agent that is as simple as possible to import this to another db. This works fine if the db is Local but throws a DXLImporter error (the log says: “<?xml version='1.0'?>Entry not found in indexDXL importer operation failed”) if the db is server based.
I’ve tried this with a replica of a blank db on Local and on a server, it imports properly on the Local db.
The code for the import agent is:
Sub Initialize
Dim session As New NotesSession
Dim dbdir As NotesDbDirectory
Dim db As NotesDatabase
Dim stream As NotesStream
Dim importer As NotesDXLImporter
Set stream = session.CreateStream
If Not stream.Open("c:\dxl\test1.dxl") Then
Msgbox "Cannot open test1.dxl", , "Error"
Exit Sub
End If
If stream.Bytes = 0 Then
Msgbox "File did not exist or was empty", , FileName$
Exit Sub
End If
Set db = session.CurrentDatabase
srvr$ = db.Server
Set db = New NotesDatabase(srvr$, "migration\CodeSt.nsf")
If Not db.IsOpen Then Exit Sub
Set importer = session.CreateDXLImporter
importer.ReplaceDBProperties = False
importer.ReplicaRequiredForReplaceOrUpdate = False
importer.ACLImportOption = DXLIMPORTOPTION_REPLACE_ELSE_IGNORE
importer.DesignImportOption = DXLIMPORTOPTION_REPLACE_ELSE_CREATE
Call importer.Import(stream, db)
Call stream.Close
End Sub
and the (really simple) DXL file I’m trying to import is:
Here’s code I use all the time to version certain code or entire databases - whatever I’ve exported - to a code store (on the server)
Dim session As New NotesSession
Dim dbdir As NotesDbDirectory
Dim db As NotesDatabase
Dim stream As NotesStream
Dim importer As NotesDXLImporter
Set stream = session.CreateStream
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
'current database is "BP\BP"
Set db = session.CurrentDatabase
srvr$ = db.Server
Set db = New NotesDatabase(srvr$, "BP\BPCodeSt.nsf") ' backup design
PS - I’m attempting to use DXL to modify the Database script because I drew a blank trying to save this “document” back to the db. I can access and modify it using the DBDesign class but if I try to resave it saves as a document, not the Database Script (even though all the items and flags appear correct through Notespeek).
If anyone has managed to programatically modify this script can you please let me know.