Examples: CopyAllItems method

This agent copies all the items on the highlighted document, docA, into a new document, docB, and then saves docB.

Sub Initialize
  Dim session As New NotesSession
  Dim db As NotesDatabase
  Dim docA As NotesDocument
  Dim docB As NotesDocument
  Dim collection As NotesDocumentCollection
  Set db = session.CurrentDatabase
  Set collection = db.UnprocessedDocuments
  Set docA = collection.GetFirstDocument()
  If Not (docA Is Nothing) Then
    Set docB = New NotesDocument( db )
    Call docA.CopyAllItems( docB, True )
    Call docB.Save( True, True )
    Messagebox "No documents found"
  End If
End Sub