That old chestnut..remove rt item i don't know its name

Hi,I need to remove an attachment on a document.

I want to use the remove method of the notesembeddedobject, BUT i do not know what the attachment name will be:

Set rtitem = doc.GetFirstItem( “RGDocumentation1” )

If ( rtitem.Type = RICHTEXT ) Then

Set object = rtitem.GetEmbeddedObject( “Name of attachment” )

Call object.Remove

Call doc.Save( True, True )

e.g. in this line, how can I specifiy ‘whatever attachments in the RGDocumentation1 field’.

The notes help example is a total waste of space, as it assumes you will know what the attachment is called. In practice, for me at least, this is never the case…

p.s. yes i’ve tried adding a $v2attachmentoptions field, this makes no difference…

Subject: that old chestnut…remove rt item i don’t know its name

Iterate through the rtitem.EmbeddedObjects and remove any you find.

Forall o in rtitem.EmbeddedObjects

call o.Remove

end forall

Look in Designer help for EmbeddedObjects and NotesEmbeddedObject.

Regards,

Don

Subject: RE: that old chestnut…remove rt item i don’t know its name

There is no need to know the attachment name as you are deleting it.But if you want the name of the attachment, while iterating as specified by Don McNally, you get the attachment name with ‘o.name’.