Saturday, May 27, 2006

NotesDXLExporter export fails on document with attachment

This is from an my answer to a post on Notes.net.
The problem was that NotesDXLExporter failed to export document in UI to XML if there was an attachment in the document, even if the document was manually saved in UI.


I could reproduce this error.
It happens under following conditions:
a)create a new mail document, add attachment to it, save the document but do not close it. Run the code (agent action or form button).
b)open an existing mail document, add attachment to it, save the document without closing it. Run the code.

It happens only with attachments, adding an inline picture does not generate the error. Triggering a LS agent to perform export results in same error.

Once you closed and re-opened the document, everything works fine until you add a new attachment.

Maybe some antivirus attachment control operations can make Notes think that attachment is new even on "old" documents, but I could not test this.

I could however make the DXLExporter work by programmatically re-opening the document, I guess it's the only solution:


Sub Click(Source As Button)
Dim session As New notessession
Dim doc As notesdocument
Set ws=New NotesUIWorkspace
Set uidoc = ws.CurrentDocument
Set doc = uidoc.Document
Call uidoc.save
Call uidoc.close

Set ws=New NotesUIWorkspace
Set uidoc=ws.editdocument(False, doc)
Set doc = uidoc.Document
Set dxle = session.CreateDXLExporter
Msgbox dxle.Export(doc)
Msgbox dxle.Log
End Sub

1 comment:

Adi said...

Oes Tsetnoc one of the ways in which we can learn seo besides Mengembalikan Jati Diri Bangsa. By participating in the Oes Tsetnoc or Mengembalikan Jati Diri Bangsa we can improve our seo skills. To find more information about Oest Tsetnoc please visit my Oes Tsetnoc pages. And to find more information about Mengembalikan Jati Diri Bangsa please visit my Mengembalikan Jati Diri Bangsa pages. Thank you So much.