Examples: GetAttachment method

  1. This script gets an attachment called JIM.SAM from a document.
    Dim doc As NotesDocument
    Dim object As NotesEmbeddedObject
    '...set value of doc...
    Set object = doc.GetAttachment( "jim.sam" )
  2. This script checks the Body item of a document to see if it contains an attachment called JILL.SAM. If not, the script uses GetAttachment to search the entire document for the attachment.
    Dim doc As NotesDocument
    Dim rtitem As Variant
    Dim object As NotesEmbeddedObject
    '...set value of doc...
    Set rtitem = doc.GetFirstItem( "Body" )
    If ( rtitem.Type = RICHTEXT ) Then
      ' check for attachment in Body item
      Set object = rtitem.GetEmbeddedObject( "jill.sam" )
      If ( object Is Nothing ) Then
        ' check for attachment in rest of document
        Set object = doc.GetAttachment( "jill.sam" )
      End If
    End If