Using NotesRichTextItem EmbedObject to add an attachment

Hi,

I am using NotesRichTextItem EmbedObject to add an attachment. The attachment gets added below the body contents and it adds a line separating body and attachments. And the icon is displayed as a Grey Mass.

I want the icon to be displayed and the attachment to be placed in the body of the mail at the current cursor location. Did anyone tried this before, if so help me on this.

Thanks in advance,

Agasthya

Subject: using NotesRichTextItem EmbedObject to add an attachment

Example copys attachment to the doc2 Body field…

Dim session As New NotesSession

Dim workspace As New notesuiworkspace

Dim db As NotesDatabase  

Dim doc As NotesDocument

Dim doc2 As NotesDocument

Dim item1 As NotesItem



Dim item2 As NotesItem



Dim uidoc As notesuidocument





Set db= session.CurrentDatabase

Set uidoc= workspace.currentdocument

Set doc=uidoc.document       



Set doc2 = db.createdocument

Set item1 = doc.GetFirstItem ("Body")

' This agent uses the CopyItem method to demonstrate.



' To demonstrate using the CopyItemToDocument method



' remark the line below, and unremark the line below that.



 'Call doc2.copyitem(item1, "Body")     

Set item2=item1.copyitemtodocument(doc2, "Body") 

Call Doc2.Save (True, True)

Subject: RE: using NotesRichTextItem EmbedObject to add an attachment

Hi,

I tried the sample code, but it gives an error “Property is not available for this object”.

I added a button on the form and on click of that i added this code. When i run the form and click the button i get the above mentioned error.

Am I missing anything.

Thanks in advance,

Agasthya