例: GetNthHeader method

  1. 次のエージェントは、MIME エンティティの Subject ヘッダーを表示します。
    Sub Initialize
      Dim s As New NotesSession
      Dim db As NotesDatabase
      Dim dc As NotesDocumentCollection
      Dim doc As NotesDocument
      Dim mime As NotesMIMEEntity
      Dim header As NotesMIMEHeader
      Set db = s.CurrentDatabase
      s.ConvertMIME = False
      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 header = mime.GetNthHeader("Subject")
          If header Is Nothing Then
            subject$ = "No subject"
          Else
            subject$ = header.GetHeaderVal
          End If
          Messagebox mime.ContentAsText,, subject$
        Else
          Messagebox "Not MIME",, _
          doc.GetItemValue("Subject")(0)
        End If
      End If
      s.ConvertMIME = True ' Restore conversion
    End Sub
  2. 次のエージェントは、MIME エンティティの Received ヘッダーすべてを表示します。
    Sub Initialize
      Dim s As New NotesSession
      Dim db As NotesDatabase
      Dim dc As NotesDocumentCollection
      Dim doc As NotesDocument
      Dim mime As NotesMIMEEntity
      Dim header As NotesMIMEHeader
      Set db = s.CurrentDatabase
      s.ConvertMIME = False
      Set dc = db.UnprocessedDocuments
      Set doc = dc.GetFirstDocument
      If Not(doc Is Nothing) Then
        Set mime = doc.GetMIMEEntity
        If Not(mime Is Nothing) Then
          For i = 1 To 99
            Set header = mime.GetNthHeader("Received", i)
            If header Is Nothing Then Exit For
            Messagebox header.GetHeaderVal,, "Received # " & i
          Next
        Else
          Messagebox "Not MIME",, _
          doc.GetItemValue("Subject")(0)
        End If
      End If
      s.ConvertMIME = True ' Restore conversion
    End Sub