Examples: Preamble property
- This agent gets the preamble for a multipart MIME item.
Sub Initialize Dim s As New NotesSession Dim db As NotesDatabase Dim dc As NotesDocumentCollection Dim doc As NotesDocument Dim mime As NotesMIMEEntity Set db = s.CurrentDatabase s.ConvertMIME = False Set dc = db.UnprocessedDocuments Set doc = dc.GetFirstDocument While Not(doc Is Nothing) Set mime = doc.GetMIMEEntity If Not(mime Is Nothing) Then If mime.ContentType = "multipart" Then Messagebox mime.Preamble,, _ doc.GetItemValue("Subject")(0) Else Messagebox "Not multipart",, _ doc.GetItemValue("Subject")(0) End If Else Messagebox "Not MIME",, _ doc.GetItemValue("Subject")(0) End If Set doc = dc.GetNextDocument(doc) Wend s.ConvertMIME = True ' Restore conversion End Sub
- This agent sets a preamble in the parent entity of a multipart
MIME 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 s.ConvertMIME = False ' Retain MIME format Set doc = db.CreateDocument REM Create parent entity Call doc.ReplaceItemValue("Form", "Memo") Set body = doc.CreateMIMEEntity Set header = body.CreateHeader("Content-Type") Call header.SetHeaderVal("multipart/mixed") body.Preamble = "Preamble to multipart MIME message." Set header = body.CreateHeader("Subject") Call header.SetHeaderVal("MIME multipart message") Set header = body.CreateHeader("To") Call header.SetHeaderVal("Roberta Person") Set stream = s.CreateStream REM Create first 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_NONE) Call stream.Truncate REM Create second child entity Set child = body.CreateChildEntity Call stream.WriteText("Text of message for child 2.") Call child.SetContentFromText(stream, _ "text/plain", ENC_NONE) Call doc.Save(True, True) s.ConvertMIME = True ' Restore conversion End Sub