例: PickListCollection メソッド

  1. 次の例は、「ProgWork2」という名前のデータベースの [By Author] ビューにある文書を、モーダルウィンドウで表示します。次いで、選択リストの Subject アイテムを表示します。
    Sub Click(Source As Button)
      Dim session As New NotesSession
      Dim workspace As New NotesUIWorkspace
      Dim db As NotesDatabase
      Dim collection As NotesDocumentCollection
      Dim doc As NotesDocument
      Dim item As NotesItem
      Set db = session.CurrentDatabase
      Set collection = workspace.PickListCollection( _
      PICKLIST_CUSTOM, _
      True, _
      "snapper", _
      "ProgWork2", _
      "By Author", _
      "My Dialog", _
      "Please select a document or two." )
      If collection.Count = 0 Then
        Messagebox "User canceled" ,, _
        "Subject item on the document(s)" 
      Else
        Set doc = collection.GetFirstDocument
        While Not ( doc Is Nothing )
          Set item = doc.GetFirstItem( "Subject" )
          If ( item Is Nothing ) Then
            messagelist = messagelist & "None" & Chr(10)
          Else
             messagelist = messagelist & item.Text & Chr(10)
          End If
          Set doc = collection.GetNextDocument (doc)
        Wend
        Messagebox messagelist ,, _
        "Subject item on the document(s)"
      End If
    End Sub
  2. 次の例は、「ProgWork2」というデータベースの [By Author] ビューにある文書を、モーダルウィンドウで表示します。そして、ユーザーが [OK] をクリックしたら、選択文書を「My Folder」というフォルダに保存します。
    Sub Click(Source As Button)
      Dim session As New NotesSession
      Dim workspace As New NotesUIWorkspace
      Dim db As NotesDatabase
      Dim collection As NotesDocumentCollection
      Set db = session.CurrentDatabase
      Set collection = workspace.PickListCollection( _
      PICKLIST_CUSTOM, _
      True, _
      "snapper", _
      "ProgWork2", _
      "By Author", _
      "My Dialog", _
      "Please select a document or two." )
    'The following line puts the selected documents in a folder
    'called My Folder. The value False means that a folder will
    'not be created if one does not already exist.
      Call collection.PutAllInFolder( "My Folder", False )
    End Sub