Hi
also ich hab jetzt das hier...
Sub Initialize
Dim session As New NotesSession
Dim doc As NotesDocument
Set doc = session.DocumentContext
Dim db As NotesDatabase
Set db = session.CurrentDatabase
'Move the V2 file attachment to the rich text field
Set rtitem = New NotesRichTextItem ( doc, "AttachmentFiles" )
Set FileList = doc.GetFirstItem("$File")
If Not FileList Is Nothing Then
Forall item In Filelist.values
Set object = doc.GetAttachment( item)
If object.Type = EMBED_ATTACHMENT Then
datadir$ = session.GetEnvironmentString("Directory", True)
FilePath$ = datadir$ & "\" & item
Call object.ExtractFile(FilePath$)
Call object.remove
Call rtitem.embedObject(EMBED_ATTACHMENT,"",FilePath$,"")
End If
End Forall
' Finally, delete the file from the file system
On Error Resume Next
Kill FilePath$
End If
End Sub
Aber damit klappt das irgendwie nicht :-(
und hiermit auch nicht
Sub Initialize
Dim ses As New NotesSession
Dim doc As NotesDocument
Dim v2File As NotesItem
Dim rtItem As NotesRichTextItem
Dim inputAttachment As NotesEmbeddedObject
Dim tempDirectory As String
Dim fileName As String
Dim filePath As String
Dim moveToFieldName As String
moveToFieldName = "Rt_Dokument_Anhänge"
Set doc = ses.DocumentContext
Set v2File = doc.GetFirstItem ( "$File" )
fileName = v2File.Values(0)
Set inputAttachment = doc.GetAttachment ( fileName )
tempDirectory = ses.GetEnvironmentString ( "Directory", True )
filePath = tempDirectory + "\" + fileName
'--Save the file on the server
Call inputAttachment.ExtractFile ( filePath )
'--Delete the original attachment
Call doc.RemoveItem ( "$File" )
'--Create the rich text item and re-attach the file
If doc.HasItem ( moveToFieldName ) Then
Set rtItem = doc.GetFirstItem ( moveToFieldName )
Else
Set rtItem = New NotesRichTextItem ( doc, moveToFieldName )
End If
Set inputAttachment = rtItem.EmbedObject ( EMBED_ATTACHMENT, "", FilePath )
'--Finally, delete the file from the server file system
Kill FilePath
End Sub
Hat jemand vielleicht eine Idee warum?
Danke