Uselsx "*javacon"
%REM
Function saveResourceOnDisk
В случае успешной выгрузки возвращает полный путь с именем файла
%END REM
Function saveResourceOnDisk(db As NotesDatabase, noteid As String, dirName As String, fileName As String) As String
On Error GoTo ErrH
Dim DXLExporter As NotesDXLExporter
Dim nstream As NotesStream
Dim note As NotesDocument
Dim noteDXL As String
Dim fileTxt As String
Dim pos1 As Long
Dim pos2 As Long
Dim jSession As JavaSession
Dim jClass_Base64Binary As JavaClass
Dim jMethod_decode As JavaMethod
Set note = db.GetdocumentById(noteid)
Set nstream = session.CreateStream()
Set DXLExporter = session.CreateDXLExporter(note, nstream)
Call DXLExporter.Process()
noteDXL = nstream.ReadText()
Call nstream.Close()
pos1 = Instr(noteDXL, fileName)
pos1 = Instr(pos1, noteDXL, {<filedata>}) + Len({<filedata>})
pos2 = Instr(pos1, noteDXL, {</filedata>})
fileTxt = Replace(Mid(noteDXL, pos1, pos2 - pos1), Chr$(10), "")
Set jSession = New JavaSession()
Set jClass_Base64Binary = jSession.GetClass("lotus/domino/types/Base64Binary")
Set jMethod_decode = jClass_Base64Binary.GetMethod("decode", "(Ljava/lang/String;)[B")
Call nstream.Open(dirName + fileName, "Binary")
Call nstream.Write(jMethod_decode.Invoke(, fileTxt))
Call nstream.Close()
saveResourceOnDisk = dirName + fileName
Exit Function
ErrH:
'...
Exit Function
End Function