Paul,
You are correct. I have done more research to understand this correctly. Thanks for reminding me about the data source.
1. I have created a form and view in which I can add an attachment.
2. In a test Xpage I have a link with this code behind the link:
docID = "C8B2303F9D74E0E786257BD3006E2D03";
attNme = "Scoular Corporate Aircraft Use Policy (11-18-11).pdf";
var imgURL = facesContext.getExternalContext().getRequest().getContextPath() + "/0/" + docID + "/$File/"+ attNme;
imgURL
This works in the web GREAT - the attachment opens.
In the client (9.0.0.0) I get the following error.
Error 500: Unexpected Error Condition.
I also have found a separate article that suggests doing this:
docID = "C8B2303F9D74E0E786257BD3006E2D03";
attachmentName = "Scoular Corporate Aircraft Use Policy (11-18-11).pdf";
function getAttachmentURL(docID, attachmentName) {
var base = getBaseURL();
var middle = "/xsp/.ibmmodres/domino/OpenAttachment";
if (base.substr(0,4) == "/xsp") {
middle += base.substr(4);
} else {
middle += base;
}
var result = base + middle + "/" + docID + "/Body/" + attachmentName + "?Open";
return result;
}
function getBaseURL() {
var curURL = context.getUrl();
var curAdr = curURL.getAddress();
var rel = curURL.getSiteRelativeAddress(context);
var step1 = curAdr.substr(0,curAdr.indexOf(rel));
// Now cut off the http
var step2 = step1.substr(step1.indexOf("//")+2);
var result = step2.substr(step2.indexOf("/"));
return result;
}
//getAttachmentURL(docID, attachmentName);
This doesn't seem to work.
Would love to know how to get the first example to work in the client.