例: SetParamVal method

次の例では、マルチパート MIME エンティティが作成され、必要に応じてパラメータ値が設定されます。Form アイテムの生成には X-Notes-Item ヘッダーが使用されます。

Sub Initialize
  Dim s As New NotesSession
  Dim db As NotesDatabase
  Dim doc As NotesDocument
  Dim body As NotesMIMEEntity
  Dim header As NotesMIMEHeader
  Dim child As NotesMIMEEntity
  Dim stream As NotesStream
  Set db = s.CurrentDatabase
  Set stream = s.CreateStream
  s.ConvertMIME = False ' Do not convert MIME to rich text
  Set doc = db.CreateDocument
  
  REM Create the parent entity
  Set body = doc.CreateMIMEEntity
  REM Create header for Content-Type
  Set header = body.CreateHeader("Content-Type")
  Call header.SetHeaderVal("multipart/mixed")
  REM Create additional headers for mail message
  Set header = body.CreateHeader("X-Notes-Item")
  Call header.SetHeaderVal("Memo")
  Call header.SetParamVal("name", "Form")
  Set header = body.CreateHeader("Subject")
  Call header.SetHeaderVal("MIME multipart message")
  Set header = body.CreateHeader("To")
  Call header.SetHeaderVal("Roberta Person")
  
  REM Create child entity
  Set child = body.CreateChildEntity
  Call stream.WriteText("Text of message for child 1." & Chr(10) & Chr(10))
  Call child.SetContentFromText(stream, "text/plain", ENC_QUOTED_PRINTABLE)
  Call stream.Truncate
  
  Call doc.Send(False)
  s.ConvertMIME = True ' Restore conversion
End Sub