Can I move an attachment from the $FILE into the Body field?

Hi,

Our customer used to attach huge (500Mb) files into the Body (RTF) field on the main document of that Production Server DB, but the process was not good because it used to tie up the user Notes Client while the file was being attached. So the customer asked us to provide a solution.

Then we figured that a local agent would make it easier so that the user just select the files, which would be temporary placed in a temp folder in the HD. Then, in a local DB (user machine), the scheduled agent goes to the temp folder and uploads the files in background, without tying up the Notes client.

Each 5 minutes the agent looks for files to be attached. One file is uploaded at the time and one file is attached per document. The agent attaches the file in the Body field (see part of the code below).

Dim rtitem As NotesRichTextItem
Dim object As NotesEmbeddedObject

Dim fileName$

fileName$ = doc.FileName(0)

Set rtitem = New NotesRichTextItem( doc, “Body” )
Set object = rtitem.EmbedObject (EMBED_ATTACHMENT, “”, fileName$ )

Kill fileName$

doc.Completed = “Yes”
Call doc.ComputeWithForm( False, False )
Call doc.Save(True, False)

The solution works fine the majority of times, but we are not being able to understand one situation:

For some files, they are being attached directly to the document. The $FILE is there with the file stuff, but the Body field is empty…

We do not know what happens to the Body field, because it is intermittent, but my real problem is that the customer is not happy seeing the file at the bottom line of the document (instead of in the Body field, which is blank).

  1. Can someone explain what is going wrong with my agent?

  2. Can I place the file back to the Body field? How?

Any tip would be much appreciated. Thanks in advance.

Paulo