Examples: AddValText method

This agent adds an encoded character to the "Subject" header.

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
  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 header = mime.GetNthHeader("Subject")
      If Not(header Is Nothing) Then
        txt$ = "Æ"
        Call header.AddValText(txt$, "iso-8859-1")
        Call doc.Save(True, True)
      End If
    Else
      Messagebox "Not MIME",, doc.GetItemValue("Subject")(0)
    End If
  End If
  s.ConvertMIME = True ' Restore conversion
End Sub