例: SaveFileDialog メソッド

次のエージェントは、[名前を付けて保存] ダイアログボックスでファイル名を取り出し、選択した文書の Body アイテムをその名前のファイルに書き出します。

Sub Initialize
  Dim ws As New NotesUIWorkspace
  Dim session As New NotesSession
  Dim db As NotesDatabase
  Dim dc As NotesDocumentCollection
  Dim doc As NotesDocument
  REM Get selected document
  Set db = session.CurrentDatabase
  Set dc = db.UnprocessedDocuments
  Set doc = dc.GetFirstDocument
  If Not(doc Is Nothing) Then
    REM Get filename from user
    filenames = ws.SaveFileDialog( _
    False,"File name",, "c:¥work", "Body.txt")
    If Not(Isempty(filenames)) Then
      REM Write Body item to file
      fileNum% = Freefile()
      Open filenames(0) For Output As fileNum%
      Print #fileNum%, doc.GetItemValue("Body")(0)
      Close fileNum%
    End If
  End If
End Sub