Mime.htm $File disappears?

Hi, can anyone help???

We are receiving an e-mail from one of our suppliers which has, when document properties are viewed from the Inbox, a $File with the following attributes:

Field Name: $FILE

Data Type: Attached Object

Data Length: 44 bytes

Seq Num: 1

Dup Item ID: 0

Field Flags: ATTACH SIGN SEAL SUMMARY

Object Type: File

Object ID: 00034B02

Object Length: 43068

File Name: mime.htm

Flags:

Host: 2304

Compression Type: NONE

Encoding Type:

File Attributes: RW PUBLIC

File Size: 43068

File Created: 16/11/2010 23:44:24

File Modified: 16/11/2010 23:44:24

When the mail is opened the contents are displayed very nicely in the Body of the e-mail.

My problem is that when I programmatically access the body field there is nothing there, and once opened into the UI the $File item disappears from the list of available items!!

Normally with embedded/attached items they stay available and I can pick them up, save them out of Notes and then pick them up and put them in the Other Records in our Other systems.

Does anyone know how to do this for this type of attached item???

Thanks in advance.

Subject: Are you accessing the body as MIME data?

Or are you letting the API convert it to rich text? See ConvertMIME property in the Designer help. If you convert to rich text and then change and resave the document, you may lose information.

Subject: Not sure I understand but here’s some of my code…

Just opening the document in the Mail app so that it displays in the User Interface and then the User pushes an action button that access the document in LS as follows:

Dim s As New NotesSession

Dim ws As New NotesUIWorkspace

Set db = s.CurrentDatabase

Set uidoc = ws.CurrentDocument

Set doc = uidoc.Document

At this point if you look in the doc.items the $File item has disappeared. Also, of course, the Body Item contains nothing.

For all other embedded/attached items the following code seems to work fine, and has done for a few years,:

Set rt2 = New NotesRichTextItem(newEvent, “Attacha”)

Call rt2.AppendText(bodd)

If procattach = “X” Then

Set rt1 = doc.GetFirstItem(“Body”)

If Not Isempty(rt1.EmbeddedObjects) Then

 Forall object In rt1.EmbeddedObjects

 If ( object.Type = EMBED_ATTACHMENT And object.FileSize > 0 ) Then

filename=ReplaceSubstring(object.Name,"?","")

filename=ReplaceSubstring(filename,"\","")

filename=ReplaceSubstring(filename,"/","")

filename=ReplaceSubstring(filename,":","")

filename=ReplaceSubstring(filename,"<","")

filename=ReplaceSubstring(filename,">","")

filename=ReplaceSubstring(filename,"|","")

filename=ReplaceSubstring(filename,"*","")

filename=ReplaceSubstring(filename,Chr$(9),"")

Call object.ExtractFile("c:\nobblesext\" & filename)

 End If

 Call rt2.EmbedObject(EMBED_ATTACHMENT, "", "c:\nobblesext\" & filename)

  If Dir$("c:\nobblesext\" & filename) = filename Then

Kill "c:\nobblesext\" & filename

  End If	

End Forall

End If

End If

Not exactly sure if this sheds more light on what you asked or not.

Subject: the document is in mime format, not notes rich text format

the short answer:

you need to use the MIME apis to access the document data. as andre suggested, see the designer help for information on the MIME apis. (and be sure to set the session property, ConvertMIME, to false or you will get a mime->cd conversion when you access the document.)

some background:

regarding the “file attachment”: it’s not really an attachment, per se.

here are the doc properties from your original post:

Field Name: $FILE

Data Type: Attached Object

Data Length: 44 bytes

Seq Num: 1

Dup Item ID: 0

Field Flags: ATTACH SIGN SEAL SUMMARY

Object Type: File

Object ID: 00034B02

Object Length: 43068

File Name: mime.htm

Flags:

Host: 2304

Compression Type: NONE

Encoding Type:

File Attributes: RW PUBLIC

File Size: 43068

File Created: 16/11/2010 23:44:24

File Modified: 16/11/2010 23:44:24

note the Host type (in red bold). usually this would be MSDOS for a typical file attachment (or Mac for a Mac attachment). the value 2304 is HOST_STREAM and it’s used when we store large bytestreams in file attachments, but don’t want them handled as regular file attachments by the Notes client; e.g., OLE objects are stored this way as are large MIME parts which don’t fit in a single Body item.

in your case, the mime.htm attachment corresponds to a Body item with a data type of MIME. if you look at the doc properties for the doc’s Body item(s), you should see one with a content-type header with a type/subtype of text/html. however, rather than containing the html for the part. it will contain the name of the attachment which contains the html – mime.htm; a level of indirection, if you will.

when MIME parts are larger than about 40KB, we ‘redirect’ them to attachments; you’ll note that the attachment above is about 42KB. these file attachments will have a host type of HOST_STREAM as does the mime.htm attachment in your example.

you must use the MIME apis in order to successfully access the content of documents such as this one.