Subject: attachment on web
Perhaps like this in a WebQuerySave-agent for form A:
Dim session As New NotesSession
Dim db As NotesDatabase
Dim docContext As NotesDocument
Dim docB As NotesDocument
Dim embObject As NotesEmbeddedObject
Dim rtItem As NotesRichTextItem
Dim strTempDir As String
Dim vEval As Variant
Set db = session.CurrentDatabase
Set docContext = session.DocumentContext
'-- Create new doc and copy some values.
Set docB = db.CreateDocument
Call docB.ReplaceItemValue(“Form”, “DocB”)
Call docB.ReplaceItemValue(“FirstName”, docContext.GetItemValue(“FirstName”)(0))
Call docB.ReplaceItemValue(“LastName”, docContext.GetItemValue(“LastName”)(0))
Set rtItem = New NotesRichTextItem(docB, “Body”)
'-- This code tries to get the temp-catalog using the ‘Environ’ function.
'-- If the server isn’t a Windows server, you will have to get the catalog for temporary storage in some other manner.
strTempDir = Environ(“temp”)
If strTempDir = “” Then strTempDir = Environ(“tmp”)
If Right$(strTempDir, 1) <> "" Then strTempDir = strTempDir & ""
'-- Get any attachments.
vEval = Evaluate(“@AttachmentNames”, docContext)
ForAll v In vEval
If v <> “” Then
'-- The file must be detached to disk,
'-- then attached to the new document.
Set embObject = docContext.GetAttachment( v )
Call embObject.ExtractFile( strTempDir & v )
Call rtItem.EmbedObject( EMBED_ATTACHMENT, “”, strTempDir & v )
End If
End ForAll
'-- Don’t forget to save.
Call docB.Save(True, False)