Examples: GetLastDocument method (NotesDocumentCollection - LotusScript®)

This script gets the last document in a collection, and copies it to another database.

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