Embedded image

Hi,

I need detach embedded image from “notes” to File System.

I try with the following code in a button:

    Dim doc As NotesDocument

Dim ws As New NotesUIWorkspace 

Set doc = ws.CurrentDocument.Document 

Dim rtitem As Variant

Dim fileCount As Integer





fileCount = 0    



Set rtitem = doc.GetFirstItem( "Body" )

If ( rtitem.Type = RICHTEXT ) Then

	Forall o In rtitem.EmbeddedObjects

		If ( o.Type = EMBED_ATTACHMENT ) Then

			fileCount = fileCount + 1

			Call o.ExtractFile _

			( "c:\newfile" & Cstr(fileCount) )

			

		End If

	End Forall

End If

this work fine, but only for Attachment Files.

any idea?

thanks in advance.

Subject: Embedded image

What about getting the files name then parsing out the extention, e.g., .jpg or .gif.

To get the name use this…

Dim varObjects As Variant

varObjects = Evaluate({@AttachmentNames}, doc)

FileName = varObjects(0)

Then loop the attachments and export to the file system only if the extension matches your desired set.

use something like this to loop…

		'Save the file to the TEMP dir...

		If ( rtitem.Type = RICHTEXT ) Then

			Forall o In rtitem.EmbeddedObjects

				If ( o.Type = EMBED_ATTACHMENT ) Then

					Call o.ExtractFile( Folder+FileName  )

				End If

			End Forall

		End If

Yancy Lent

http://www.lotusreport.com