vijay
vijay

Reputation: 1

How to open an attachment using a link in an xpage?

How to open an attachment in an xpage using a link url? What are all the fields iln the url? Pls explain. Also about the document folder created in the 'xsppers' folder.

Upvotes: 0

Views: 2560

Answers (1)

Michael Saiz
Michael Saiz

Reputation: 1640

The short answer how to open a attached Image is:

http://pathToyourDatabase/DatabaseName.nsf/0/DocumentUniversalID/$File/MyImage.jpg

you can create this link with:

var imageurl = facesContext.getExternalContext().getRequest().getContextPath() + "/0/" +  
                /*in my case: viewEntry.getDocument().getUniversalID()*/ 
                + "/$File/"+ AttachmentName;

placing this link in the src attribute of an <img> or in the url attribute of the <xp:image> tag will dislay this image on your xPage. This example works fine for me but for other Attachments you maby have to add ?OpenElement after the AttachmentName.

Update: I did a short experiment on this with a pdf file and it worked without the ?OpenElement just use the code to generate the url it should work. Additional you can look @ Link.

Upvotes: 4

Related Questions