Export/Import DXL needs to discard doc object before accessing updated information
Daniel Nashed – 22 April 2010 21:01:08
I ran into some very behaviour today. I have used DXL export and import to change some information in the document and wanted to access the updated document afterwards.
Accessing the document after a re-open via db.GetDocumentByUNID gave me the old document instead of the updated document.
The only way I found to re-load the document was to set the doc to nothing to close the older instance of the document.
I thought the GetDocumentByUNID would re-open the database but it gets a reference to the existing document instead.
Isn't that odd?
-- Daniel
--- do some work with document ---
call doc.save (true, false)
doc_unid = doc.UniversalID
Dim stream As NotesStream
Dim out_str As String
Dim replace_str As String
Dim exporter As NotesDXLExporter
Set stream = session.CreateStream
Set exporter = session.CreateDXLExporter
Call exporter.SetInput(doc)
Call exporter.SetOutput(stream)
Call exporter.Process
out_str = stream.ReadText
replace_str = Replace (out_str, newline_string, "<break/>")
Dim importer As NotesDXLImporter
Set importer = session.CreateDXLImporter
importer.DocumentImportOption = DXLIMPORTOPTION_UPDATE_ELSE_IGNORE
Call importer.Import(replace_str, db)
Set doc = Nothing
Set updated_doc = db.GetDocumentByUNID( doc_unid )
--- do some work with updated_doc ---
- Comments [4]