Examples: GetFirstDocument method (NotesDocumentCollection - LotusScript®)

This script gets the first 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("","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