Examples: Removing a document

  1. This example removes all of the documents in a folder.
    Sub Initialize
      Dim session As New NotesSession
      Dim db As NotesDatabase
      Dim view As NotesView
      Dim doc As NotesDocument  
      Set db = session.CurrentDatabase
      Set view = db.GetView("Folder1")
      Set doc = view.GetFirstDocument()
      While Not(doc Is Nothing)
         Call doc.Remove(True)
         Set doc = view.GetFirstDocument()
      Wend
    End Sub
  2. This example deletes a document from a collection.
    Sub Initialize 
      Dim session As New NotesSession
      Dim db As NotesDatabase
      Dim collection As NotesDocumentCollection
      Dim doc As NotesDocument
      Dim nid As String
      Set db = session.CurrentDatabase
      Set collection = db.FTSearch("white wine", 0)
      Set doc = collection.GetFirstDocument()
      Call collection.DeleteDocument(doc)
    End Sub