例: GetLastDocument method (NotesDocumentCollection - LotusScript®)

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

Sub Click(Source As Button)
  Dim session As New NotesSession
  Dim db As NotesDatabase
  Dim db2 As New NotesDatabase("","Ankara.nsf")
  Dim collection As NotesDocumentCollection
  Dim doc As NotesDocument
  
  Set db = session.CurrentDatabase
  Set collection = db.FTSearch("Business", 10)
  Set doc = collection.GetLastDocument
  Call doc.CopyToDatabase(db2)
End Sub