LOTUSSCRIPT/COM/OLE CLASSES


Examples: CreateParentEntity method
This agent gets the MIME entity in the current document. If the entity is not multipart, the agent creates a parent entity. The agent then appends a child entity.

Sub Initialize
 Dim s As New NotesSession
 Dim db As NotesDatabase
 Dim dc As NotesDocumentCollection
 Dim doc As NotesDocument
 Dim mime As NotesMIMEEntity
 Dim parent As NotesMIMEEntity
 Dim stream As Notesstream
 Set db = s.CurrentDatabase
 s.ConvertMIME = False ' Do not convert MIME to rich text
 Set stream = s.CreateStream
 Set dc = db.UnprocessedDocuments
 Set doc = dc.GetFirstDocument
 If doc Is Nothing Then Goto ExitSub
 Set mime = doc.GetMIMEEntity
 If Not(mime Is Nothing) Then
   If mime.ContentType <> "multipart" Then
     Set parent = mime.CreateParentEntity
   Else
     Set parent = mime
   End If
   Set mime = parent.CreateChildEntity
   Call stream.WriteText("Additional text." & _
   Chr(10) & Chr(10))
   Call mime.SetContentFromText(stream, _
   "text/plain", ENC_NONE)
   Call doc.Save(True, True)
 Else
   Messagebox "Not MIME",, doc.GetItemValue("Subject")(0)
 End If
ExitSub:
s.ConvertMIME = True ' Restore conversion
End Sub

See Also