I’m making an app to view office documents using Microsoft Office Online API, however, I wasn’t able to create a public link for the file using Javascript.
Specifically
var downloadUrl = context.fileList.getDownloadUrl(fileName);
This is a local link to the logged in user, Microsoft Online Viewer can’t read it, can some one help me with the link creating process in java-script?
OCA.MSOfficeViewer.FileClick = function (fileName, context) {
//downloadUrl is not a direct/public link to the file, thus it'll not be readable by microsoft viewer,
//we need to replace by a public link
var downloadUrl = context.fileList.getDownloadUrl(fileName);
var currentUrl = encodeURI(context.fileList.linkTo() + '?path=' + context.dir);
//need to get nextcloud URL dynamically instead of hardcoding in the app
var onedrive = "https://view.officeapps.live.com/op/view.aspx?src=";
var linkElement = onedrive + baseUrl + downloadUrl;
If someone manages to help with this, they’ll be credited when the app is released.