Examples: IsFolder property (NotesView - LotusScript®)

This script performs a full-text search on a database and puts the matching documents into a folder. It prompts the user for a word to search for, and for the name of a folder. The script uses IsFolder to make sure the user enters a folder name, and not a view name.

Dim query As String
Dim folderName As String
Dim session As New NotesSession
Dim db As NotesDatabase
Dim view As NotesView
Dim collection As NotesDocumentCollection
Dim doc As NotesDocument
query = Inputbox$( "What string do you want to search for?" )
folderName = Inputbox$ _
( "Which folder do you want the documents in?" )
Set db = session.CurrentDatabase
Set view = db.GetView( folderName )
If ( view Is Nothing ) Then
  Messagebox _
  ( folderName & " does not exist in this database." )
Elseif Not ( view.IsFolder ) Then
  Messagebox( folderName & _
  " is a view, not a folder. Please enter a folder." )
Else
  Set collection = db.FTSearch( query, 0 )
  Set doc = collection.GetFirstDocument
  While Not ( doc Is Nothing )
    Call doc.PutInFolder( folderName )
    Set doc = collection.GetNextDocument( doc )
  Wend
End If