EmbeddedObject.remove does not remove

Hi there

i created a java agent, which embeds files to richtext fields. Everytime i have a newer file, i have to remove the old and attach the new one.

Okay. Attaching works fine, but, when i call remove, the file will be attached to the document bottom line. After the remove, i save the document and get all objects from the document, but they are not there?!?!

I also tried to remove the complete field, but no chance, field and files are still there.

So, does remove something? :slight_smile:

What can i try? I dont have more ideas…

Subject: EmbeddedObject.remove does not remove…

remove() doesn’t “stick” until the document is saved.

Subject: RE: EmbeddedObject.remove does not remove…

yes, i save my document after each line…when i remove the item containing a file, save it, and then embed a new file, works ok, but the confusing thing is, the old file hangs in the documents bottom. i tried this at the end of my script:

Vector v = doc.getEmbeddedObjects();

for(int t=0; t<v.size(); t++) {

eobj = (EmbeddedObject)v.get(t);

System.out.println(“body=”+eobj.getName());

}

says nothing…

and:

If doc.HasEmbedded Then

Forall eo In doc.EmbeddedObjects

	Messagebox( eo.Name )

End Forall

End If

the script of an action in the document says type mismatch?!?

what?

Subject: RE: EmbeddedObject.remove does not remove…

Same problem here… :frowning:

Subject: Other methods doesn’t work also …

I tried this:

EmbeddedObject eo = doc.getAttachment( pdfName );

    if( eo != null ) {

      cat.debug( "Attachment \"" + eo + "\" zum Entfernen gefunden worden." );

      eo.remove();

      doc.save(true, true );        

    }

if I use the method getEmbeddedObjects() on the document, the vector has a size of zero.

Vector vec = doc.getEmbeddedObjects();

System.out.println( vec.size() );

But there are any embeddedobjects, set with:

rtXmlFile.embedObject(EmbeddedObject.EMBED_ATTACHMENT, “”, fileName, pdfName );

I guess, my code sometimes worked, and now it doesn’t.

Subject: RE: Other methods doesn’t work also …

As of Notes 8 this is still not working.

EmbeddedObject.remove() does not work in java.

NotesEmbeddedObject.Remove() does work in LotusScript, but it does not remove the visual trace of the object if it is in a RichTextItem, only the “$File” Item that is in the document.

Does anyone know if there is a bug fix about this?