Examples: PickListCollection method

  1. This example displays the documents in the By Author view of a database named ProgWork2 in a modal window then displays the Subject items from the selected list.
    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. This example displays the documents in the By Author view of a database called ProgWork2 in a modal window and saves the selected documents to a folder called My Folder when the user clicks OK.
    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