次のエージェントは image/gif MIME エンティティのコンテントを取得し、それを GIF ファイルに保存します。
Sub Initialize
Dim s As New NotesSession
Dim db As NotesDatabase
Dim dc As NotesDocumentCollection
Dim doc As NotesDocument
Dim mime As NotesMIMEEntity
Dim stream As NotesStream
Set db = s.CurrentDatabase
s.ConvertMIME = False ' Do not convert MIME to rich text
Set dc = db.UnprocessedDocuments
Set doc = dc.GetFirstDocument
If Not(doc Is Nothing) Then
Set mime = doc.GetMIMEEntity
If Not(mime Is Nothing) Then
If mime.ContentType = "image" And _
mime.ContentSubtype = "gif" Then
Set stream = s.CreateStream
pathname$ = "c:¥lotus¥notes¥data¥temp.gif"
If Not stream.Open(pathname$, "binary") Then
Messagebox pathname$,, "Open failed"
Goto ExitSub
End If
Call mime.GetContentAsBytes(stream)
Call stream.Close();
Else
Messagebox "Not GIF",, doc.GetItemValue("Subject")(0)
End If
Else
Messagebox "Not MIME",, doc.GetItemValue("Subject")(0)
End If
End If
ExitSub:
s.ConvertMIME = True ' Restore conversion
End Sub