Wednesday, April 11, 2018

SharePoint Online - Make Office File to Open in Desktop Application by default Instead of Online

In a SharePoint documents library, documents will be opened in client application by default, if the “Open Documents in Client Applications by Default site” site collection feature is activated.






However, if you use document URL as a link in another place, clicking the link will not open document in desktop application. It will open the document in online app.

Solution for that is, add respective Office URI Scheme to the beginning of the document URL. For a Excel document, link should be like: ms-excel:ofe|u|https://abc.sharepoint.com………
List of URL scheme names available for Microsoft Office applications are:
  • ms-word:
  • ms-powerpoint:
  • ms-excel:
  • ms-visio:
  • ms-access:
  • ms-project:
  • ms-publisher:
  • ms-spd:
  • ms-infopath:

Sample jQuery code to open an Excel document in desktop application on a button click is:
$("#btnOpenExcelFile" ).click (function() {
window.open( "ms-excel:ofe|u|https://abc.sharepoint.com/:x:/r/sites/BD/Shared%20Documents/Submissions%20List%20(Excel).xlsx?d=wda689ae3bb824932b2fd607a7870b107&csf=1&e=xTBvDI");
});


No comments: