例: FTDomainSearch method

[ディレクトリカタログ] データベース内の検索フォーム上のボタンに配置した場合、次のコードは指定された検索文字列でディレクトリを検索し、すべての結果を返します。

Sub Click(Source As Button)
    Dim s As New NotesSession
    Dim db As NotesDatabase
    Dim w As New NotesUIWorkspace
    Dim uidoc As NotesUIDocument
    Dim doc as NotesDocument
    Dim quer As String
    Dim srdoc as NotesDocument
    
    
    Set db=s.CurrentDatabase
    Set uidoc = w.currentdocument
    uidoc.refresh
    Set doc=uidoc.Document
    
    quer=doc.query(0)
    
    On Error Resume Next     
    If db.isopen Then
        If Err <> 0 Then
            Messagebox STR_DBOPEN_ERROR, 0 , STR_ERROR
            Err = 0
            Exit Sub
        End If
        
        Set srdoc = db.ftdomainsearch(quer, 0)
        
        If Err <> 0 Then
            Messagebox STR_NDF , 0 , STR_LOTUS_NOTES
            Err=0
            Exit Sub
        End If
        
        srdoc.Form="SearchResults"
        Call w.EditDocument(False, srdoc, True)
    End If
End Sub