次のエージェントは、選択されている文書の Body アイテムの内容をストリームに書き込み、読み込みが開始される前にストリームを始点 (0) に配置します。
Sub Initialize
Dim session As NotesSession
Dim db As NotesDatabase
Dim dc As NotesDocumentCollection
Dim doc As NotesDocument
Dim stream As NotesStream
Set session = New NotesSession
Set db = session.CurrentDatabase
Set dc = db.UnprocessedDocuments
Set doc = dc.GetFirstDocument
REM Create stream
Set stream = session.CreateStream
REM Write text of Body item to stream
Call stream.WriteText(doc.GetItemValue("Body")(0))
REM Reset position to beginning of stream
stream.Position = 0
REM Read text from stream
Messagebox stream.ReadText(),, "Text read from stream"
End Sub