Links to Sharepoint Document in Excel Opens in Browser

Copper Contributor

Hi

 

We have several spreadsheets that have hyperlinks to documents in Sharepoint folders. Until recently, when the hyperlink is selected the document would open in the application. However, recently, more often than not the document is downloaded via the browser (Chrome). Sometimes the link behaves as expected and the document will open in its native application but will then revert back without intervention.

 

I have checked the Sharepoint and Office 365 settings and the default is to open documents in their native application and this works when the document is opened from explorer.

 

Thanks for any help you can give.

 

Regards

 

Jon

30 Replies

Just to crosscheck both these settings are selected as below right?

Library > Library Settings > Advanced settings > Opening Documents in the Browser > Default open behavior for browser-enabled documents.

Site Settings > Site Collection Administration > Site Collection Features > Open Documents in Client Applications by Default.

 

Also make sure none of the addons are corrupted. Try to reinstall addons like NameCtrlClass and SharepointDocumentClass.

 

If none of above work try to repair and reinstall office and let us know.

 

Thank you very much for your reply and suggestions.

 

I have done everything suggested. The  settings were already as required. However, opening the documents from the links in Excel still attempts to open them in the browser rather than with the native application.

 

Is there anything else I can try?

Hi Jon,

 

Hi got to the bottom of this.. after many hours and then Microsoft support.

 

You will need to customize the link in order for it to open in the local program.

 

For instance, this link will open a document called Test.xlsx in a web browser:

https://contoso.sharepoint.com/:x:/r/sites/Test/_layouts/15/Doc.aspx?sourcedoc=%7B5E9CC057-1F22-40A9...

 

However, if you browse to the document library, and then copy and customize the address and add the filename, you could make the link look like this:

https://contoso.sharepoint.com/sites/Test/Shared%20Documents/Test.xlsx

This document will now open in Excel the program rather the web browser.

 

You will need to make sure their default web browser is logged into Office 365, and that the prompt to allow the document to open in the program is accepted and you can save the choice. It may still prompt to click ok in the future when clicking a link that defaults to open in the program.

 

Also, you will need to make sure that in Library Settings for the site, and in Advanced Settings, that you have set the default open behavior for browser-enabled documents to open in the client application.

 

If you want to avoid the user being prompted to open the Excel program when using the customized link, you can use Excel URI schemes to modify the custom link.

This website contains information on URI schemes with MS Office applications.

 

Office URI Schemes

https://docs.microsoft.com/en-us/office/client-developer/office-uri-schemes

 

You will need to use the customized link as mentioned already with the addition of the URI scheme to open the Excel program without prompting when using a link from within an office application, or if you want to create a regular link you can place on a users desktop or in my documents that links to the SharePoint file.

To create a hyperlink that links to an Excel document in SharePoint online, and to open that document in Excel with editing enabled without being prompted, this would be the format:

 

ms-excel:ofe|u|https://contoso.sharepoint.com/sites/Test/Shared%20Documents/Test.xlsx

 

You would then need to right click on the cell and click Link and set it to be a hyper link with the address using the same exact text with the entire contents of the link included in the address.

 

The URI schemes article describes how to setup links for Excel and other MS Office programs, and the options that are available to open the documents such as in view only or edit mode.

Jon - that's impressive detective work, but Microsoft, are you kidding? Why do those settings exist in Sharepoint Administration if they don't actually work? Is the ridiculous kluge that Jon had to piece together really the only way to actually force O365 to open file links in their native applications instead of a browser? This behaviour completely flummoxes our users, especially if they don't happen to be logged into O365 in the browser, in which case the "Open in..." command doesn't appear in the menu bar. No standard user is going to go to the lengths (or know how to go to the lengths) Jon describes simply to get O365 to do what it should by rights do by default (and used to do, until somebody decided to change it a few months ago).

@domemsgroupThanks for encouraging me to look at this again. I too tried making the default behavior to open Excel in the app not the browser and the steps did not always work for me. In particular, I have a dashboard page where staff expect to click on the document to open it in the app. I trained them to click on "Open in Excel" from the drop down or open in Excel from the browser Excel, but I kept getting calls that the macro wouldn't work (due to the file being open in the browser).

 

I don't want to go in and create the links as you described, so for these sorts of pages I add jQuery and a reference to a script file that removes the SharePoint behavior of opening the file in the browser by removing the onclick attribute of the hyperlink tag.

 

<script type="text/javascript">
// tested with jQuery 1.11.3

$(document).ready(function() {
$("a[onclick^='CoreInvoke']").removeAttr('onclick');
}); //document ready
</script>

 

This does the trick, at least in Firefox. Also, for this page I didn't care if all of the onclick events were removed.

Thanks a lot - but why so long a description? All I actually needed to use from your answer is this ms-excel:ofe|u| prefix at the beginning. And the magic happens! :)

@domemsgroup 
Really interesting reading - I first though I was alone in this.
I'm trying to open a Word document, saved in a SharePoint site, with Excel.

The "ms-word:ofe|u|" prefix doesn't work and your instruction about setting default browser actions cannot be found in Excel's options.

Is it possible to obtain a little helping push to make it work?

It's Office 2016 products.

@Bamsefar 

 

You need to copy the file path from the file  

then the link would be

"ms-word:ofe|u|" your file path then remove ?web=1 from the end of the pasted text.

 

msword:ofe|u|https://yourfilepath.docx 

remove?web=1

@domemsgroupThis doesn't work because there's no app registered by default in Windows to handle this link as you've constructed it, and none are offered by Windows. Beyond that, this is a kluge workaround and not a solution to the real problem. No typical user is going to edit hyperlinks - this platform is for people doing real everyday work, not techheads who are willing to code their way around Microsoft obstacles.

@AthenianRazak Agreed its ridiculous. Its a basic requirement for a user to link files wherever they maybe.  

 

This was a fix for one case I came across after a SharePoint Migration. 

 

 

Here is what I do to make links to SharePoint documents open in their client apps:

1. To make the link work from SharePoint, the library settings (advanced) must be set to open in Client (but if in classic view this setting is ignored).

2. When you paste the link you copy from SharePoint, remove all text after the document extension beginning with the ? (so it just ends with the document extension) – otherwise when someone clicks the link in any MS app, the document opens in a browser.

 

IMO, it would be simpler for SharePoint to simply provide a choice of two versions of link - one that ends in the document extension (call in 'Client link') and one that has the other stuff at the end (call it 'Browser link') but until then this is a fairly easy fix and it works in my world - hope it works for you too!

Sharing links for files on SharePoint, not having ?Web=1 downloads the file and does not open in the app, having ?Web=1 opens in browser, not app - solution?

Should not be reliant on end user browser settings.

Totally breaks the sharing capability!  So annoying!

I just shared an excel document stored on SharePoint link in Teams chat and it downloads the file.  I added the "?Web=1" after having to go into edit mode and create a link and that works to open in the browser.  WHY DOES THE LINK DOWNLOAD AND NOT OPEN IN THE NATIVE APP?   This is really getting frustrating.  I tried the "ms-excel:ofe|u|" prefix and the link creator said it was not a valid link and would not let me even try it.  Any help appreciated.  I agree with another poster that having to add extensions and prefixes cannot be sustainable, either.  Behavior of the link should not be based on settings in individual systems either for collaboration.

@ShelliG_N We have felt your pain.  You may not have the privileges to change your library settings, but I would first try to follow the advice of Anonymous (04-16-2018 02:09 PM) to change the libraries' Advanced Settings/Opening Documents in the Browser to "Open in the client application." If you want this behavior to apply to the site in general, and have the administrative privileges to update the site settings, then turn the Open docs in client app by default option as well (Site Settings > Site Collection Administration > Site Collection Features > Open Documents in Client Applications by Default.).

 

Lately, I have had success using the Edge browser with these settings. Firefox has an internal setting controlling which apps open which documents, that would sometimes get reset (maybe on an update?), which added to the confusion of users that expected the app to open but the file would just get downloaded instead of downloaded and opened. We don't support Chrome (historical reasons) so I haven't tried it lately.

 

If none of this works, we have at times, added specific links to menus or to HTML sections on pages. I think following the advice of @domemsgroup for how to refer to the files is the best approach--use a link that directly refers to the file, library URL + file name, and not the link that SharePoint gives you. This approach has allowed us to evade changes in behavior due to SharePoint updates or browser variation. Not very satisfying, but a few key documents resulted in more than their fair share of help desk calls.

 

Good luck!

@80Mark80 Thanks! 

I think this is more than just a browser issue, however as the latest issue was in the Teams app with a link to an Excel spreadsheet on SharePoint.

 

I rarely use the link that SharePoint gives me and try to always use the direct link because then people know how to go look for the document or similar documents if the link is ever broken.  I really do not understand the SharePoint provided link benefit anyway.

 

 I do not have privileges but I can certainly push for someone to help me look into this.  Would the site collection settings prevent from wanting to download?  Seems like it would only dictate to open in native/client app or browser.

 

This is a new behavior that links are downloading instead of trying to open somewhere. :(

@ShelliG_N Thanks for the additional information about your system configuration. We haven't been using Teams to access files like that. I just uploaded a PowerPoint document to try it out. Teams seems to have a version of PowerPoint built in, so the document opened inside of Teams. Not exactly the desktop application but maybe good enough. To get the PowerPoint file to open in the desktop application I had to click on the "Open in SharePoint" menu option on the the top menu. I then updated the Document Library settings (hopefully you have privileges to do this) via the setting menu (gear in upper left corner). Select "Advanced Settings" and then select "Open in the client application" for the "Opening Documents in the Browser" setting. Then, if you click on "Open in SharePoint" from the Teams menu and click on the file in the SharePoint folder that opens in your browser, the document will, hopefully, open in the desktop application. This worked for me when I used Edge as my default browser. Once you have updated the library setting, it should apply for all users and you shouldn't have to change it again. But with all things SharePoint humility applies, so no guarantees.

 

Still probably not what you wanted to hear. But I hope it helps.

Folks, you've derailed this thread onto a topic not really related to the original. This isn't about Teams links, and it's not about whether a link causes a file to download or not. Understood this may be a problem for you, but you should start a new topic rather than usurping this one. The original issue was that links created in Sharepoint open Office application files (e.g, XLSX) in the browser rather than in the native app regardless of the settings. This still isn't fixed, though Microsoft is perpetually monkeying around with things and has at least made it easier to edit created links (just delete everything starting with the "?" after the file extension in the URL). That said, the Advanced Settings for how documents open by default still have no effect on Sharepoint's behavior, so it's pointless to fuss with them.

@ShelliG_N Thanks for the additional information. Teams appears to be opening Office files, like Excel, in a browser-like view which for Excel gives the confusing options to open in the desktop app or just to edit or view in Teams. This is confusing for most people. If you want to avoid this, then try this approach, which is related to the current thread of opening Excel files from SharePoint.

 

From Teams, select the option to "Open in SharePoint." This should open a view of the SharePoint document library in the default browser--I've tested this in Edge for Excel and PowerPoint files. The first time you access this document library, see if you have the privileges to update the Document "Library Settings" (from the setting "gear" in the upper left, near your Office 365 account picture/initials), advanced settings, to select the option "Open in the client application" for "Opening Documents in the Browser." If you were able to do that, then the next step hopefully works for you.

 

Now click on the file you want to open in the desktop application from the SharePoint Document Library (not from Teams), and it should open in the desktop application. This works for me using Office 365 E3 / Excel (and PowerPoint) / SharePoint Online (modern experience) / Edge (v.83.0.478.37) on a Windows 10 Pro (v.1909) machine. But as you can tell from this thread, your mileage may vary--even if you have exactly the same setup, SharePoint can frustrate. And I'm not sure that it less confusing to users to have to go to the SharePoint side of Teams before opening a file, but at least they won't have both the Teams and the Desktop app showing them the same file (really confusing).

@AthenianRazak I do not agree that the comments are hijacking the feed but will start a new topic.  This is directly related to links to SharePoint documents and how they open.