Examples: GetParamVal method

This agent gets the value of the Content-Type header and its "charset" parameter.

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 ' 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 header = mime.GetNthHeader("Content-Type")
      If header Is Nothing Then
        contentType$ = "No Content-Type!"
      Else
        contentType$ = header.GetHeaderVal
        mycharset$ = header.GetParamVal("charset")
        If mycharset$ = "" Then mycharset$ = "No charset!"
      End If
      Messagebox contentType$ & Chr(10) & mycharset$,, _
      "Content-Type & charset"
    Else
      Messagebox "Not MIME",, doc.GetItemValue("Subject")(0)
    End If
  End If
  s.ConvertMIME = True ' Restore conversion
End Sub