Very big problem with EmbeddedObjects

Hi

I have a form with a Richtext field. In this field, user can attach documents. In QuerySave event I want to check size of attachments to cancel save event if attachments are greater than 1M. How I can do this using lotuscript.

Thanks

Subject: Very big problem with EmbeddedObjects

EmbeddedObjects or attachments?

you can’t. why LS, use @Formula

Subject: RE: Very big problem with EmbeddedObjects

I have a similar problem:

I use the code below and get all attachments, but not the graphic that’s in the body:

If Isarray(rtItem.EmbeddedObjects) Then

Forall Object In RTItem.EmbeddedObjects

  Select Case Object.Type

Case EMBED_ATTACHMENT:

   Messagebox "Attachment"

Case EMBED_OBJECT:

   Messagebox "Embedded"

  End Select

End Forall

End If

Any idea what’s wrong with this? I’ve been banging my head against the wall for days on this.

Thanks,

Peter Mello

Subject: RE: Very big problem with EmbeddedObjects

I think you’ll find that graphics are in-line data rather than embedded objects.

Subject: RE: Very big problem with EmbeddedObjects

Thanks for the reply, but the help files indicate that OLE objects are accessed via EmbeddedObjects. Is there documentation that discusses the methodology you describe?

Thanks again,

Peter Mello

Subject: RE: Very big problem with EmbeddedObjects

That’s what I’m getting at – an inline image is not an OLE object. It’s a “splat” of data sitting in the rich text field – just bytes that paint a picture with header “tags” that apply the properties. Fundamentally not different from a paragraph, except that it’s difficult to read in a text editor. You can access the picture as a file if you get the document by HTTP URL, you can get a Base64 version as a NotesBitMap or a GIF by exporting as DXL, or you can use the C API (or a third-party tool like the Midas Rich Text LSX – I think Midas does this) to dig out the image bytes and create an image file.

Subject: RE: Very big problem with EmbeddedObjects

I tried this code and the object “mime” is always nothing:

Dim mime As NotesMimeEntity

Dim stream As NotesStream

Set mime=doc.GetMIMEEntity

If Not(mime Is Nothing) Then

If mime.ContentType = “image” Then

  Set stream = session.CreateStream

  pathname$ = AppPath & "\temp\image." & mime.ContentSubtype

 If Not stream.Open(pathname$, "binary") Then

    Messagebox pathname$,, "Open failed"

Goto NormalExit 'exit app

 End If

 Call mime.GetContentAsBytes(stream)

 Call stream.Close()

Else

  Messagebox "Not an image",,doc.GetItemValue("Subject")(0)

End If

Else

Messagebox “Not MIME”, doc.GetItemValue(“Subject”)(0)

End If

Subject: RE: Very big problem with EmbeddedObjects

Where did you get the idea that inline Notes data is MIME?

Subject: RE: Very big problem with EmbeddedObjects

As Stan points out, normal Notes rich text data is not MIME, it is a stream of CD (Composite Data) records stored across a potential series of items. It is possible to set a rich text field to “Save as HTML and MIME”, which would allow access the way you suggest, but you lose quite a bit in the bargain, both because the translation is not great and because any translation back and forth between two formats will entail loss over time.