RichText Items in Email Body

Is there way a way to get a handle on a picture within the body of a memo?

For instance, you take a “print screen” and paste it directly into the Body of the email. Is there a way to grab that picture and save it or anything like that?

TIA.

Subject: RichText Items in Email Body

Here is some code that I wrote to dump the embedded pictures from a NotesRichText field to an external file. It records the name of the file in a field called “AttachedFiles”.

Sub WriteEmbedded2File(doc As NotesDocument)

            Const PATH="C:\Temp\"



Dim session As New NotesSession

Dim stream As NotesStream

Dim body As NotesMimeEntity

Dim oldMimeFlag As Variant 

Dim exporter As NotesDXLExporter

Dim out As String

Dim filenum As Integer

Dim p1 As Long

Dim p2 As Long

Dim cnt As Integer

Dim strFileName As String 

Dim strOutputName As String

Dim strDirOutput As String 

Dim numSize As Long

Dim bSave As Boolean

Dim tempitem As NotesItem



oldMimeFlag = session.ConvertMIME	

session.ConvertMIME = False



Set exporter = session.CreateDXLExporter

exporter.ConvertNotesBitmapsToGIF = True

out = exporter.Export(doc)



p1=1

While p1>0

	

	p2=0

	p1 = Instr(p1+10, out, "<gif originalformat='notesbitmap'>", 5)		

	If p1>0 Then p2 =Instr(p1, out, "</gif>", 5)

	

	If p2>0 Then

		

		numSize = p2-p1-35

		

		If numSize > 2500 Then

			

			Set stream = session.CreateStream	

			

			' Copy text into MIME object

			Set body = doc.CreateMIMEEntity("mime" & cnt)

			stream.WriteText Mid$(out, p1+35, numSize)

			body.SetContentFromText stream, "", ENC_BASE64

			stream.Truncate

			

			' Dump contents of MIME object out to a file

			strFileName = "Embedded" & doc.UniversalID & cnt & ".gif"

			strOutputName = PATH & strFileName

			strDirOutput = Dir(strOutputName)

			If Dir(strOutputName) <> strFileName Then

				If stream.Open(strOutputName, "binary") Then

					body.GetContentAsBytes stream

					stream.Close

					Set stream = Nothing

					If doc.HasItem("AttachedFiles") Then

						Set tempitem = doc.GetFirstItem("AttachedFiles")

					Else

						Set tempitem = doc.ReplaceItemValue("AttachedFiles","")

					End If

					tempitem.AppendToTextList strFileName & Chr(10)

					bSave = True

				End If	

			End If

			

			body.Remove

			Set body = Nothing

			

		End If

		

		cnt = cnt + 1

		

	End If

Wend



session.ConvertMime = oldMimeFlag



If bSave Then

	doc.Save True, True

End If

End Sub

Subject: RichText Items in Email Body

There is no built in feature that allows this, although I can’t imagine why not. Your choices aren’t that great if you need to make this work. You can read the e-mail through the web, which then allows a right click and save, or you can export to DXL and parse out the images and decode and save them, or you can use a third party product to export the images (our Midas Rich Text LSX has an ExportGraphic method, for example, but there are other products that do this as well).

Subject: RichText Items in Email Body

Another thought. If I have the handle of the Notesdocument in VB is there any way to “print” it?