Lotus Software logo
IBM Lotus Domino Designer 8.5
  Versions 8.5 and 8.5.1






Examples: SetContentFromBytes method

This agent creates a document in MIME format. The MIME content is one GIF file.

Sub Initialize

Dim s As New NotesSession
Dim db As NotesDatabase
Dim doc As NotesDocument
Dim body As NotesMIMEEntity
Dim stream As NotesStream
Set db = s.CurrentDatabase
s.ConvertMIME = False ' Do not convert MIME to rich text
Set doc = db.CreateDocument
Call doc.ReplaceItemValue("Form", "Main Form")
Set body = doc.CreateMIMEEntity
Set header = body.CreateHeader("Subject")
Call header.SetHeaderVal("MIME image from GIF file")
Set stream = s.CreateStream
If Not stream.Open("c:\lotus\notes\data\folder.gif", _
"binary") Then
Messagebox "c:\lotus\notes\data\folder.gif",, _
"Open failed"
Goto ExitSub
End If
If stream.Bytes = 0 Then
Messagebox "c:\lotus\notes\data\folder.gif",, _
"File has no content"
Goto ExitSub
End If
Call body.SetContentFromBytes(stream, _
"image/gif", ENC_IDENTITY_BINARY)
Call stream.Close
Call doc.Save(True, True)
ExitSub:
s.ConvertMIME = True ' Restore conversion
End Sub
Related topics
SetContentFromBytes method




Library | Support | Terms of use |

Last updated: Monday, October 5, 2009