次のエージェントは、MIME 形式で文書を作成します。MIME コンテントは 1 つの GIF ファイルです。
Sub Initialize
Dim s As New NotesSession
Dim db As NotesDatabase
Dim doc As NotesDocument
Dim body As NotesMIMEEntity
Dim stream As NotesStream
Set db = s.CurrentDatabase
s.ConvertMIME = False ' Do not convert MIME to rich text
Set doc = db.CreateDocument
Call doc.ReplaceItemValue("Form", "Main Form")
Set body = doc.CreateMIMEEntity
Set header = body.CreateHeader("Subject")
Call header.SetHeaderVal("MIME image from GIF file")
Set stream = s.CreateStream
If Not stream.Open("c:¥lotus¥notes¥data¥folder.gif", _
"binary") Then
Messagebox "c:¥lotus¥notes¥data¥folder.gif",, _
"Open failed"
Goto ExitSub
End If
If stream.Bytes = 0 Then
Messagebox "c:¥lotus¥notes¥data¥folder.gif",, _
"File has no content"
Goto ExitSub
End If
Call body.SetContentFromBytes(stream, _
"image/gif", ENC_IDENTITY_BINARY)
Call stream.Close
Call doc.Save(True, True)
ExitSub:
s.ConvertMIME = True ' Restore conversion
End Sub