Examples: GetLastDocument method (NotesView - LotusScript®)
This script gets the last document in the Main View of a discussion database. The first column in the Main View is sorted by date, in ascending order; therefore, the last document is the newest document in the view.
Dim db As New NotesDatabase( "France", "foodwine.nsf" )
Dim view As NotesView
Dim doc As NotesDocument
Set view = db.GetView( "Main View")
Set doc = view.GetLastDocument