例: GetFirstDocument method (NotesDocumentCollection - LotusScript®)

次のスクリプトはコレクションの最初の文書を取得して、文書を別のデータベースにコピーします。

Sub Click(Source As Button)
  Dim session As New NotesSession
  Dim db As NotesDatabase
  Dim db2 As New NotesDatabase("","Project.nsf")
  Dim collection As NotesDocumentCollection
  Dim doc As NotesDocument
  
  Set db = session.CurrentDatabase
  Set collection = db.FTSearch("Business", 10)
  Set doc = collection.GetFirstDocument
  If Not doc Is Nothing Then
    Call doc.CopyToDatabase(db2)
  End If
End Sub