I thought it would return a vector of attachment urls so i tried the following code.
i used the following code :
<xp:image>
<xp:this.url><![CDATA[#{javascript:
var att = widgetDocument.getAttachmentList("BodyImage");
if(att.size() >0) {
return att.get(0);
}
}]]></xp:this.url>
which produces the following not working image :
on the server console i got a "couldnt find design note - com.ibm.xsp.model.domino.wrapped.DominoDocument$AttachmentValueHolder@1a161a16 [/Luc/liodoc0_4fp.nsf/com.ibm.xsp.model.domino.wrapped.DominoDocument$AttachmentValueHolder@1a161a16]
am i doing something wrong?
my purpose is just to display a image which was entered as attachment in a rich text field.
Subject: returns java.util.arrayList of NotesEmbeddedObjects
Luc,
I had trouble with this too, but finally figured out that getAttachmentList returns a list (specifically a java.util.arrayList) of NotesEmbeddedObjects.
You can use methods of the NotesEmbeddedObject like getName(), getType(), and getFileSize() once you have the NotesEmbeddedObject.
Example:
Here is some server-side javascript I put into a computed field to get a list of the names of the file attachments on my XPage. docDoc is the name of my data source defined in the XPage and “Attachments” is the name of the rich text field that the file upload control is bound to.
var attachmentNames = “”;
if (docDoc.getAttachmentList(“Attachments”).isEmpty()){
attachmentNames = "No Files Yet";
} else {
var v = docDoc.getAttachmentList("Attachments");
for (i=0; i < v.length; i++){
var eo:NotesEmbeddedObject = v.get(i);
attachmentNames = attachmentNames + eo.getName() + "<BR>";
}