Forum Discussion
Default view mode/edit mode behavior for Word and Excel Online files
I want to do this as well. I have trolled through all the settings that I could think of with no success. Were you able to find out how to do it?
- Onno van EwykNov 07, 2018Copper Contributor
Hi Bynum Hoekstra
I had a bit of a look around and found this blog post in which some of the responses give hope for a solution.
- AndrewFivePJul 09, 2019Copper Contributor
Onno van Ewyk I've replied to this blog post with a solution for this issue. Please see my reply below:
Hi All,
You can achieve setting the default to 'View" mode by using SharePoint Column Formatting.
Simply update your column (in my case I updated Name to keep the experience seamless) with the following json and your documents will now open in Preview instead of Edit:
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/column-formatting.schema.json",
"elmType": "a",
"txtContent": "@currentField",
"attributes": {
"target": "_blank",
"href": "=if(indexOf([$ContentTypeId], '0x0120') >= 0, '?id=' + [$FileRef], @currentWeb + '/_layouts/15/Doc.aspx?sourcedoc='+ [$UniqueId] + '&action=View')"
}
}What this does is checks if the item is a folder and uses existing behavior to open the folder otherwise it will open the document in view mode.
Hope this helps anybody looking for a way to solve this issue!
- mharris28Sep 22, 2020Copper Contributor
AndrewFiveP This is great! Is it possible to apply this formatting to only one sub-folder of a SharePoint library? It seemingly is applying to my entire library, but I'd prefer it to apply in only one specified place.