When is a NotesDXLExport finsished?

Hi there,I’m about to set up an agent which, when called, asks the user (that’s me), which design-element should be exported and mailed. This works quite good, except the DXL-file is emtpy, when it’s getting mailed. As soon the agent is finished, the file is complete.

This is my code:

Dim ws As New notesuiworkspace	



Dim session As New NotesSession



Set db = session.CurrentDatabase



'### Auswahl und Export eines Designelements ########################

Dim designView As NotesView

Set designView = db.GetView("Designelemente")



Dim designCol As notesdocumentcollection

Set designCol = ws.PickListCollection( PICKLIST_CUSTOM, False, db.Server, db.FilePath, designView.Name, "Auswahl", "Welches Designelement soll exportiert werden?")



Dim designDoc As notesdocument

Set designDoc = designCol.GetFirstDocument



Dim stream As NotesStream

Set stream = session.CreateStream

path = "d:\KQVWork\"

filename = designDoc.~$Title(0) & ".dxl"

filename = path$ & filename$

If Not stream.Open(filename$) Then

	Messagebox "Cannot open " & filename$,, "Error"

	Exit Sub

End If

Call stream.Truncate



Dim nc As NotesNoteCollection

Set nc = db.CreateNoteCollection(False)

Call nc.BuildCollection	

Call nc.Add(designDoc)



Dim exporter As NotesDXLExporter

Set exporter = session.CreateDXLExporter(nc, stream)

Call exporter.Process

'######################################################



'### Vermailen des DXL-Files ####################################

Dim buttonDoc As notesdocument

Set buttonDoc = db.Search({SELECT Form = "Button"}, Nothing, 0).getfirstdocument



Dim buttonItem As NotesRichTextItem

Set buttonItem = buttonDoc.GetFirstItem("Button")



Dim memo As New notesdocument(db)

Dim body As New NotesRichTextItem(memo, "Body")

memo.form = "memo"

memo.subject = "DXL-Import eines Design-Elements"

memo.sendto = "me@domain.de"

Call body.AppendRTItem(buttonItem)



Dim anhang As NotesEmbeddedObject

Set anhang = body.EmbedObject(EMBED_ATTACHMENT, "", filename$)



Call memo.Send(False)

Is there a way to “force” completion or or?

Thanks,

Buzzy

Subject: RE: When is a NotesDXLExport finsished?

I think it’s a file buffering issue. You have to close the stream to force output of all remaining data.

Subject: When is a NotesDXLExport finsished?

Pfffff - “Call stream.Close()” did it…a pity this part misses in the help’s example :expressionless:

Thanks Andre!

Greets,

Buzzy