0

i have excel/word files in a document library. when i click on it , it opens directly on the browser. i need to get the link with the name in the end.

For example i need the url to be as below https://he.sharepoint.com/sites/General/Community%20Portal/PMCM/SiteAssets/ppm%20forms/CHANGE%20CONTROL.docx

do i have to manually create the url as above or is there a way i can extract the information from SharePoint.

0

If your view contains the column Name (linked to document with edit menu) then there will be 3 little dots right next to the filename. When you click on it you will find a field containing the document URL.

Alternatively you could create an additional column and use the JSLink CSR from this answer to display the documents URL in the column.

0

If you want to achieve this by coding side (SPService/JSOM), then FileRef attribute will return the document URl and FileLeafRef attribute will return the document Name, so finally to get the absolute URL you have to append it with Root site URL, like below in your case //JSOM Example var docUrl = oItem.get_item('FileRef'); var docName = oItem.get_item('FileLeafRef');

('https://he.sharepoint.com' + docUrl) will give you the complete url of the document

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.