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

hi,

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.DocumentImportOption = DXLIMPORTOPTION_REPLACE_ELSE_CREATE	
	importer.DesignImportOption = DXLIMPORTOPTION_REPLACE_ELSE_CREATE
	importer.ReplicaRequiredForReplaceOrUpdate = False
	' importer.InputValidationOption = VALIDATE_NEVER
	
	Call importer.Process
	
	Exit Sub
ErrorHandler:
	
	Const LSI_THREAD_PROC = 1 
	Const LSI_THREAD_CALLPROC=10
	
	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

davinder101Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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.
0
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.
0
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.

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

Sent:
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.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Sjef BosmanGroupware ConsultantCommented:
Why not an "A" ??
0
Sjef BosmanGroupware ConsultantCommented:
Thanks!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Lotus IBM

From novice to tech pro — start learning today.