Examples: GetPrevSibling method (NotesMIMEEntity - LotusScript®)

This agent gets all the MIME entities at the last level of the first branch in reverse order.

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 sibling 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
      REM drill down to end level of first branch
      Set child = mime.GetFirstChildEntity
      While Not(child Is Nothing)
        Set mime = child
        Set child = mime.GetFirstChildEntity
      REM Go to last sibling at end level of first branch
      Set sibling = mime.GetNextSibling
      While Not(sibling Is Nothing)
        Set mime = sibling
        Set sibling = mime.GetNextSibling
      REM Set up stream for file output
      Set stream = s.CreateStream
      pathname$ = "c:\lotus\notes\data\temp.txt"
      If Not stream.Open(pathname$, "us-ascii") Then
        Messagebox pathname$,, "Open failed"
        Goto ExitSub
      End If
      REM Get content of end level of first branch
      REM in reverse order
        Call mime.GetContentAsText(stream)
        Set mime = mime.GetPrevSibling
      Loop Until mime Is Nothing
      Call stream.Close()
      Messagebox "Not MIME",, doc.GetItemValue("Subject")(0)
    End If
  End If
 s.ConvertMIME = True ' Restore conversion
End Sub