DXLExporter current document - Query

I have a webquerysave agent that saves doc as an xml document.

I am trying to get it to save this current document only not all docs in the DB.

I think the problem is with my collection but am not sure what i’m doing wrong.

Any pointers greatly appreciated…

Thanks Rob

Sub Initialize

Dim session As New NotesSession

Dim db As NotesDatabase

Dim doc As NotesDocument

Dim dc As NotesDocumentCollection

Dim nid As String

Set db = session.CurrentDatabase

'Open xml file named after current database

Dim stream As NotesStream

Set stream = session.CreateStream

filename$ = "c:\dxl\" + Left(db.FileName, Len(db.FileName) - 4) + "_documents.xml"

If Not stream.Open(filename$) Then

	Messagebox "Cannot open " + filename$ + ". Check to make sure this directory exists.",, "Error"

	Exit Sub

End If



Call stream.Truncate

'Build a NoteCollection to limit the export file to documents

Dim nc As NotesNoteCollection

Set nc = db.CreateNoteCollection(False)

nc.SelectDocuments=True



Set dc = db.UnProcesseddocuments

Set doc = dc.GetFirstDocument

nid = doc.noteID



    Messagebox "Noteid " & nid 

Set doc = db.GetDocumentByID( nid )



Call nc.Add( doc )

Call nc.BuildCollection

'Export current database as DXL

Dim exporter As NotesDXLExporter

Set exporter = session.CreateDXLExporter(nc , stream)

exporter.OutputDOCTYPE = False

Call exporter.Process

End Sub

Subject: DXLExporter current document - Query

Rather than building a NotesNoteCollection, simply export the context docment…

set doc = session.DocumentContext

Set exporter = session.CreateDXLExporter(doc, stream)

But it seems like you may have to change some of the code that creates the stream (file name), since all documents would be saved to the same file, which must already exist?!

Subject: RE: DXLExporter current document - Query

thanks… forgotten about “DocumentContext”.

Filename not an issue as it gets posted to a url and overwritted daily…

rob

Subject: Try removing this line

nc.SelectDocuments=True

That property selects all documents which I think explains the behavior you’re seeing.