例: GetNthDocument method (NotesView - LotusScript®)

次のエージェントは、現在のデータベースの [Botanist's Delight] フォルダで全文検索を行います。次に文書コレクションの 2 番目の文書をフォルダから削除します。

Sub Initialize
  Dim session As New NotesSession
  Dim db As NotesDatabase
  Dim folderName As String
  Dim view As NotesView
  Dim count As Integer
  Dim doc As NotesDocument
  Set db = session.CurrentDatabase
  folderName = "Botanist's Delight"
  Set view = db.GetView( folderName )
  count = view.FTSearch( "pollution", 0 )
  If count >= 2 Then
    Set doc = view.GetNthDocument(2)
    Call doc.RemoveFromFolder( folderName )
    Call view.Clear
  Else
    Messagebox "Number found: " & count, , _
    "No documents removed"
  End If
End Sub