例: ビューエントリコレクションからエントリを取り出す

  1. 次の例では、コレクション内のエントリを検索し、そのエントリをフォルダに入れます。
    Sub Initialize
      Dim session As New NotesSession
      Dim db As NotesDatabase
      Dim view As NotesView
      Dim entryOne As NotesViewEntry
      Dim entryTwo As NotesViewEntry
      Dim vc As NotesViewEntryCollection
      Dim doc As NotesDocument
      Set db = session.CurrentDatabase
      Set view = db.GetView("By Category")
      Set vc = view.GetAllEntriesByKey("Books")
      Set entryOne = vc.GetNthEntry(2)
      Set entryTwo = vc.GetEntry(entryOne)
      Set doc = entryTwo.Document
      Call doc.PutInFolder("Shopping Cart")
    End Sub
  2. 次の例では、コレクション内の最初と最後のエントリを検索します。
    Sub Initialize  
      Dim session As New NotesSession
      Dim db As NotesDatabase
      Dim view As NotesView
      Dim entry As NotesViewEntry
      Dim entry2 As NotesViewEntry
      Dim vc As NotesViewEntryCollection
      Dim doc As NotesDocument
      Dim doc2 As NotesDocument
      Set db = session.CurrentDatabase
      Set view = db.GetView("By Category")
      Set vc = view.GetAllEntriesByKey("Products")
      Set entry = vc.GetFirstEntry()
      Set entry2 = vc.GetLastEntry()
      Set doc = entry.Document
      Set doc2 = entry2.Document
      Call doc.PutInFolder("First entries")
      Call doc2.PutInfolder("First entries")
    End Sub
  3. 次の例は、NotesView の GetAllEntriesByKey メソッドを使用してビュー内の全エントリを収集し、NotesViewEntryCollection の GetFirstEntryGetNextEntry メソッドを使用してコレクションのエントリを順に表示します。GetLastEntryGetPrevEntry メソッドを使用してコレクションの最後から順に表示することもできます。
    Sub Initialize
      Dim session As New NotesSession
      Dim db As NotesDatabase
      Dim view As NotesView
      Dim entry As NotesViewEntry
      Dim vc As NotesViewEntryCollection
      Dim doc As NotesDocument
      Set db = session.CurrentDatabase
      Set view = db.GetView("By Category")
      Set vc = view.GetAllEntriesByKey("Products")
      Set entry = vc.GetFirstEntry()
      While Not(Entry Is Nothing)
        Set entry = vc.GetNextEntry(entry)
      Wend
    End Sub