Examples: SentByAgent property

  1. This script checks if a document was sent by a script and, if so, deletes it.
    Dim doc As NotesDocument
    '...set value of doc...
    If doc.SentByAgent Then
      Call doc.Remove( True )
    End If
  2. This agent script runs when new mail is received in the current database, and processes newly received mail documents. The script checks each mail document to see if it was sent by a person; if so, it sends a reply; if not, it does nothing.
    Dim session As New NotesSession
    Dim db As NotesDatabase
    Dim collection As NotesDocumentCollection
    Dim memo As NotesDocument
    Dim reply As NotesDocument
    Set db = session.CurrentDatabase
    ' get new mail memos
    Set collection = db.UnprocessedDocuments
    Set memo = collection.GetFirstDocument()
    While Not(memo Is Nothing)
      If Not( memo.SentByAgent ) Then
        Set reply = memo.CreateReplyMessage( False )
        reply.Subject = "Re: " & memo.Subject( 0 )
        reply.Body = _
        "I'm out of the office until 3/15. John."
        Call reply.Send( False )
      End If
      Call session.UpdateProcessedDoc( memo )
      Set memo = collection.GetNextDocument(memo)