Examples: GetParentEntity method

This agent gets the preamble for the child at the end of the first or only branch of a multipart entity.

Sub Initialize
  Dim s As New NotesSession
  Dim db As NotesDatabase
  Dim dc As NotesDocumentCollection
  Dim doc As NotesDocument
  Dim mime As NotesMIMEEntity
  Dim child As NotesMIMEEntity
  Dim stream As NotesStream
  Set db = s.CurrentDatabase
  s.ConvertMIME = False ' Do not convert MIME to rich text
  Set dc = db.UnprocessedDocuments
  Set doc = dc.GetFirstDocument
  If Not(doc Is Nothing) Then
    Set mime = doc.GetMIMEEntity
    If Not(mime Is Nothing) Then
      Set child = mime.GetNextEntity(SEARCH_DEPTH)
      While Not(child Is Nothing)
        Set mime = child
        Set child = mime.GetNextEntity(SEARCH_DEPTH)
     Wend
     If Not(mime.GetParentEntity() Is Nothing) Then
       Messagebox mime.ContentAsText,, _
       mime.GetParentEntity().Preamble
     End If
   Else
      Messagebox "Not MIME",, doc.GetItemValue("Subject")(0)
    End If
  End If
  s.ConvertMIME = True ' Restore conversion
End Sub