Copying embedded picture

How to do the following?

With lotusscript, I want to copy a picture from a notesdocument (docA) to another notesdocument (docB). This has proven to be quite a challenge.

The picture is hosted in a RichText field on both docA and docB.

I have tried the following:

docB.Photo(0) = docA.Photo(0) 'This does not work

Please help!!

Thanks!

Ola

Subject: Copying embedded picture

Very tricky if teh RichText-field contains more than just the picture and you want to copy only the picture and nothing else.But, if the RichText-field contains only the picture and nothing else, it can be done.

Just use the notesRichTextItem.AppendRTItem method.

Here is an example:

Dim rtFrom As NotesRichTextItem

Dim rtTo As NotesRichTextItem

'-- Get a reference to the document containing the picture you want to copy.

Set docFrom = …

'-- … and to the RichText-item with the picture.

Set rtFrom = docFrom.GetFirstItem(“Photo”)

'-- Get the target references.

Set docTo = …

Set rtTo = docTo.GetFirstItem(“Photo”)

Note. If you are creating a new ‘target’ document, you’ll need:

Set rtTo = New NotesRichTextItem(docTo, “Photo”)

'-- Now append the ‘from’ to the ‘to’.

Call rtTo.AppendRTItem( rtFrom )

Call docTo.Save(True, False)

That should do it.

Ken Haggman, NotesHound