72 lines
1.8 KiB
QBasic
72 lines
1.8 KiB
QBasic
|
Option Public
|
|||
|
Option Explicit
|
|||
|
|
|||
|
Sub Initialize
|
|||
|
|
|||
|
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,"DXL-Datei importieren", "DXL/XML Files|*.dxl;*.xml|Textdateien|*.txt|Alle Dokumente|*.*")
|
|||
|
|
|||
|
If Isempty(filenames) Then
|
|||
|
Messagebox "Kein Dateiname angegeben",, "Fehler"
|
|||
|
Exit Sub
|
|||
|
End If
|
|||
|
|
|||
|
filename = Cstr(filenames(0))
|
|||
|
|
|||
|
If filename = "" Or Not stream.Open(filename$) Then
|
|||
|
Messagebox "Kann Datei nicht <20>ffnen: " & 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 & "-" & "Fehler 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 & ". Details geloggt nach: " & errorFileName
|
|||
|
End If
|
|||
|
|
|||
|
Msgbox messageString
|
|||
|
|
|||
|
End Sub
|