• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1208
  • Last Modified:

how to import a dxl file to a particular folder in .nsf file using lotus script


i need to import a .dxl file to a specified folder by creating agent and then using lotus script.

i am able to import a dxl file.
but what else i need to do to import the .dxl document to a specified folder ?

below is the code to import a dxl file.

On Error Goto ErrorHandler 
	Dim session As New NotesSession
	Dim database As NotesDatabase
	Dim filenames As Variant
	Dim filename As String
	Dim importer As NotesDXLImporter
	Dim ws As New notesuiworkspace
	Dim errorFileNum As Integer
	Dim errorFileName As String
	Set database = session.CurrentDatabase
	Dim stream As NotesStream
	Set stream = session.CreateStream
	filenames = ws.openfiledialog(False,"Select DXL file to import", "DXL/XML Files|*.dxl;*.xml|Text Files|*.txt|All Documents|*.*")
	If Isempty(filenames) Then
		Messagebox "Filename not specified",, "Error"
		Exit Sub
	End If
	filename = Cstr(filenames(0))
	If filename = "" Or Not stream.Open(filename$) Then
		Messagebox "Filename not specified or cannot open: " & filename,, "Error"
		Exit Sub
	End If
	Set importer = session.CreateDXLImporter(stream,database)
	importer.ReplicaRequiredForReplaceOrUpdate = False
	' importer.InputValidationOption = VALIDATE_NEVER
	Call importer.Process
	Exit Sub
	Dim messageString As String
	messageString = Now & "-" & "Error in " & session.CurrentAgent.name & ". " & _ 
	Getthreadinfo(LSI_THREAD_CALLPROC) & ", Erl()=" & Cstr(Erl()) & _
	" ,Err()=" & Cstr(Err()) & " ,Error()=" & Error() 
	If Err() = 4522 Then
		errorFileNum% = Freefile
		errorFileName$ = filename & ".log"
		Open errorFilename$  For Output As errorFileNum%
		Print #errorFileNum%, importer.log()
		Close errorFileNum%
		messageString = messageString & ".  Additional details logged to: " & errorFileName
	End If
	Msgbox messageString

Open in new window

  • 4
1 Solution
Sjef BosmanGroupware ConsultantCommented:
I suppose you import entire documents? Read the document "NotesDXLImporter class" in the Designe Help database.

Then, you'll need the methods NotexDXLImporter.GetFirstImportedNoteID and NotexDXLImporter.GetNextImportedNoteID to walk through the documents you imported. To attach a document to a specific folder, you need the NotesDocument.PutInFolder method.
davinder101Author Commented:
yes it worked for newly created folders.

but failed on default view folders

like Drafts and Send

can you tell how to insert dxl file data to these default view folder

Drafts and Send folder.
Sjef BosmanGroupware ConsultantCommented:
Drafts and Sent aren't folders, they are views. In order to make your documents appear in those views, you have to make sure the documents match the views' selection formulas.

SELECT PostedDate = "" & $MessageType = "" & @IsNotMember("D" : "A"; ExcludeFromView) & ISMAILSTATIONERY != 1 & Form != "Group" & Form != "Person"

SELECT DeliveredDate = "" & PostedDate != "" & !(@IsMember("S"; ExcludeFromView))

So, a Draft document is practically empty, the Form-field could be set to "Memo" but the rest should be empty and it will show up in the Draft-view. To make a document appear in Sent, it needs a PostedDate while DeliveredDate is empty.
Sjef BosmanGroupware ConsultantCommented:
Why not an "A" ??
Sjef BosmanGroupware ConsultantCommented:
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now