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