GetNextDocument (NotesView - LotusScript®)

Given a document in a view, returns the document immediately following it.

Defined in



Set notesDocument = notesView .GetNextDocument( document )



A NotesDocument. Any document in the view. If you specify Nothing, this method generates an error.

Return value


A NotesDocument. The document following the specified document in the view. Returns Nothing if there are no more documents in the view.


GetNextDocument returns the next document in the view regardless of what type of document it is (document, response, or response-to-response). If you want the next sibling document in the view, use GetNextSibling.

When processing documents in a loop, do not delete the document, or modify it in a way that causes it to disappear from the view or for its position to change. In that situation, GetNextDocument method may not return a useful result because the document that was the next document, is now at a different position in the view. The most common symptom of this problem is that documents are skipped when you loop through them.

To address this issue, change your logic so that you call GetNextDocument before making any change to the document. Or, use NotesView.AutoUpdate (= False) to prevent re-indexing of the view while you're using it.