简体   繁体   中英

Lotus notes client link and browser link in xpages to download file stored in server directory

I have a Xpage in which there is a link to download the ics file which I have stored on server,As when the user clicks the link, the user is able to download the file name "votes.ics".

Accordingly when it is been accessed from browser, it allows me to download the file but at the same time when I want to download the same file using the link from LOTUS NOTES Client,It throws as an error Resource file not found it means the path in notes client has an issue,

To make it more clear, For example I have a database name "SMP_Intern.nsf" in the folder name "SMP" on the server and the onclick script behind the link is

var docId = getVotingDocumentUID();
if(docId != ""){
if(@ClientType() == "Notes"){
var path_private = "server_name/SMP/SMP_Intern.nsf";
var httpUrl = path_private.split("/")[0];
var databaseUrl = (httpUrl+"!!"+path_private.split("/")[1]+"/"+path_private.split("/")[2]);
var url = "/xsp/"+databaseUrl+"/.ibmmodres/domino/OpenAttachment/"+databaseUrl+"/"+docId+"/ics_file/votes.ics";
return url;
}else{
var url = "/0/"+docId+"/$File/"+"votes"+".ics?OpenElement";
return url;
}
}else return false;

For the notes client it goes to 'if' condition and gives error resource not found,but when it is browser the 'else' condition works perfectly fine.

Both the paths are same basically but could not able to find the mistake.

Any suggestion will be helpful.

Have you tried @URLOpen( urlstring )formula for opening from client ?

The url must be a complete url http://DominoServer/DBPath/0/DocUNID/ $file/filename

var url = "http://"+path_private +"/0/"+docId+"/$File/"+"votes"+".ics?OpenElement";

@URLOpen( url );

You don't need a special treatment for Notes Client (XPiNC) in this case.

Your SSJS code for link value

var url = "/0/"+docId+"/$File/"+"votes"+".ics?OpenElement";
return url;

works for XPiNC too as the attachment is in the current database:
If current database resides on server then the URL points to the attachment on server.
If current database is a local replica then the URL points to the attachment in local database on client.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM