Код:
%REM
*--------------------------------------------
Function DetachDocFiles
Description: выгружает файлы не только из RT полей (mime тоже)
%END REM
Function DetachDocFiles(objdoc As NotesDocument, Byval filter As String, filesList List As String) As String
Dim file As String, path As String
Dim fNames As Variant
Dim o As NotesEmbeddedObject
On Error Goto ErrorHandler
Erase filesList
path=Replace(GetNotesTempDirectory(),WINFS_SEP,FS_SEP) & FS_SEP
file=""
fNames=AttachmentsName(objdoc)
Dim detach As Boolean, negative As Boolean
If Left$(filter,1)={!} Then negative=True
If negative And Len(filter)>0 Then filter=Right$(filter,Len(filter)-1)
filter=Ucase(filter)
Forall a In fNames
Set o=objdoc.GetAttachment(a)
detach=True
If Len(filter)>0 Then
If Not (Ucase(o.Name) Like filter) Then
detach=False
End If
detach=detach Xor negative
End If
If detach Then
file=o.Name
If UNID_pref Then file=objdoc.UniversalID & PREF_SEP &file
filesList(file)=path
Call o.ExtractFile(path & file)
End If
End Forall
If Len(file)>0 Then DetachDocFiles=path & file: Print {First Detached:} DetachDocFiles
Quit:
Exit Function
ErrorHandler:
Call RaiseError()
Erase filesList
Resume Quit
End Function