1

Within the modern SharePoint Online, is there a way to enter a link within a site page to open the document in the client application?

I've been able to set up the links so that they download the files, but the behavior I'm looking to get to is to open the file from SharePoint. This is to make sure edits are shared, and I'd like to force the file to open in the client application so I reduce the number of clicks and make sure macros will be enabled when the user starts editing.

In the document library, I've set it so it defaults to the client application, but in making links in a web page I can't seem to find a solution.

Using the Quick Links web part, regardless of what I enter for the URL it converts and ends with a parameter "?web=1" even if I add "?web=0". In other pages, I can use "?download=1" so I'm unsure why this behavior is being forced. This makes it so that direct links to the files always opens in the web browser.

I've tried entering the URL with the Office URI schema "ms-excel:ofe|u|" and this URL modification gets rejected, regardless of which web part I use; Link, Hero Content, Button, Quick Links, Call to Action, etc. There's an escapable error: "Add http://, https://, or mailto: to the beginning of the link and try again."

Has anyone found a solution to editing SharePoint Online web pages to link directly to opening a file in the client app?

Thank you for your time and help!

0

I found that links like this will open a document in its full client application.

https://yoururl.sharepoint.com/sites/YourSite/Shared%20Documents/YourExcelDocument.xlsm?web=0

Unfortunately, if used in a QuickLinks link, SharePoint appears to override your web=0 value like this:

https://yoururl.sharepoint.com/:p:/r/sites/YourSite/Shared%20Documents/YourExcelDocument.xlsm?web=0&web=1

I eventually found that this worked:

https://yoururl.sharepoint.com/:p:/r/sites/YourSite/Shared%20Documents/YourExcelDocument.xlsm?web=0

The key part to notice is the ":p:/r" added in the url. I'm not sure how it works, but it seems to have the effect of preventing the Quick Links from adding the additional "&web=1" to the end of the URL.

I've seen information that says that the :p means PowerPoint document, but I can confirm that it is working for me with an Excel document.

0

Did some more testing. Mileage may vary. It worked in some paces but not in others. It only works with the name+edit link. Not sure if it is useful.

This applies to links in webparts that are on a classic page. On the list page the modern experience opens the links directly in the client app as expected (set by the site controls), but the same view when added as a web part on a classic page opens in the browser and I had to open two menus ... and then ... to get the option to open it in the app. The clues above helped me to add some jQuery code which allowed Excel files to open in the client app. I tested it with the Excel file name with the edit link in the list view. I plan to test it on the file name without the edit option.

This adds the text "?web=0" to all the anchor href Excel links. The page already had loaded jQuery, I just added this to the document ready code.

$(document).ready(function() {
// mess with excel file links
    $('a.ms-listlink[href*=".xls"]').each( function(index) {
        var oldURL = $(this).attr("href");
        oldURL = oldURL + "?web=0";
        $(this).attr("href", oldURL);
    });
});

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.