LOTUSSCRIPT /COM/OLE のクラス


例:GetDocument メソッド
次のエージェントは、データベースの文書について報告します。文書コレクション dc2 には、すべての「Test」文書が含まれています。レポートは画面に表示されます。

Sub Initialize
 Dim session As New NotesSession
 Dim db As NotesDatabase
 Dim dbName As String
 dbName = "learning.nsf"
 
 Dim searchFor As String
 searchFor = "test"
 Dim dc1 As NotesDocumentCollection
 Dim doc1 As NotesDocument
 Dim dc2 As NotesDocumentCollection
 Dim doc2 As NotesDocument
 
 Dim message As String, verb As String  'report information
 
 Set db = session.GetDatabase( "courseServer", dbName)
 Set dc1 = db.AllDocuments
 Set dc2 = db.AllDocuments
 Set dc2 = db.FTSearch(searchFor, 0)
 If dc2.count = 0 Then
   Messagebox "No " & searchFor & " documents found", , _
   Ucase(dbName)
   Exit Sub
 End If
 
 Set doc1 = dc1.getFirstDocument
 message = ""
 While Not doc1 Is Nothing
   Set doc2 = dc2.getdocument (doc1)
   If Not doc2 Is Nothing Then
     verb = " is a "
   Else
     verb = " is not a "
   End If
   Message = message&Chr(13)&Chr(10) & _
   doc1.GetItemValue( "Subject" )(0) & _
   verb & searchFor
   Set doc1 = dc1.getNextDocument(doc1)
 Wend
 Messagebox message, , "Documents in " & dbName
End Sub

関連項目