Notes of my Lotus Notes Headline Animator

Search My Blog

Showing posts with label MIME. Show all posts
Showing posts with label MIME. Show all posts

Tuesday, August 2, 2016

Mime content to image file

Objective:

Sub Initialize
On Error Goto Errhandler
Dim s As New NotesSession
Dim db As NotesDatabase
Dim dc As NotesDocumentCollection
Dim doc As NotesDocument

Set db=s.CurrentDatabase
Set dc=db.UnprocessedDocuments
Set doc=dc.GetFirstDocument

Dim content As String
Dim mimeroot As NotesMimeEntity, mime As NotesMimeEntity

s.ConvertMime = False
If Not(doc Is Nothing) Then
Set mimeroot = doc.GetMIMEEntity
Set mime = mimeroot.GetNextEntity
If Not(mime Is Nothing) Then
content$ = mime.ContentAsText
Else
Print "Not a MIME"
End If
Else
Print "No document is selected"
End If

Dim stream As NotesStream
Set stream = s.CreateStream
If Not stream.Open("C:\StreamFiles\gg.jpg") Then
Messagebox pathname$,, "Open failed"
Goto theEnd
End If

Call mime.DecodeContent()
Call mime.GetContentAsBytes(stream, True)

Call stream.Close()


theEnd:
Exit Sub

ErrHandler:
Msgbox "Erl() : " & Erl() & " Err() : " & Err() & " Error : " & Error$
Print "Erl() : " & Erl() & " Err() : " & Err() & " Error : " & Error$
End Sub