次のスクリプトはデータベースで全文検索を実行し、条件に一致する文書をフォルダに入れます。ユーザーに対し検索する単語とフォルダ名を入力するよう要求します。スクリプトは IsFolder を使用して、ユーザーの入力内容がビュー名ではなくフォルダ名であることを確認します。
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