Open Documents Read-Only in Modern SharePoint
Interactive Business Systems is now Planet Technology. Looking for a new job? We work with some of the biggest names in tech, and we’re hiring! Check out our open jobs and make your next career move with Planet.
We recently were engaged on a project where we were utilizing PowerApps to present documents to employees via a kiosk application. The employees needed the ability to edit the documents and be able to open them in Office Online by default, but during testing we noticed that employees were unintentionally modifying files in Office Online. The PowerApp was for a heavy industrial fabrication shop and the target users were often wearing welding equipment and various other safety gear so asking them to be more delicate with the tooling wasn’t really a reasonable request.
As this was the first time we have encountered this type of request we assumed it would be straightforward, not so much. By default, Modern SharePoint Office Online opens the document based on the user’s permissions so if I have Contribute or Edit rights the document opens in edit mode and if I have read or view rights the document opens in read-only mode. Normally this makes sense but, in this instance, we needed to find a way around that default behavior.
Modern SharePoint Open Options
During our research we found a few potential options but none of them quite fit the need or created more administrative overhead that we weren’t willing to push on to the user base:
- Set the documents to “Open in the client application” via the Library Settings à Advanced Settings option
- They liked the Office Online aspect of this solution due to its speed and forcing it to open locally might negate some of that
- Enforcing Check In/Check Out via Library Settings à Versioning Settings
- This system was meant to be easily managed/used and while check in/check out may seem like a small thing…again additional overhead that dilutes the value of the solution
- Setting the target users permissions to read only
- Not a viable option in this situation as they did need the ability to edit the documents
- Revert the document library to appearance Classic SharePoint
- As the interface is via the PowerApp this wouldn’t really solve the problem for the target users and the folks managing the documents would have a lesser experience
Although none of those solutions fit the bill the last one is what solved our issue. Classic SharePoint gives us the ability to click a couple ellipses and then View in Browser.
Classic SharePoint Open Options
When we open the documents using this method they open in read-only mode regardless of the user’s permissions, so we were able to take the URLs for the same document opened in Office Online and determine what the necessary URL would be to open them in read-only by default.
Modern SharePoint Document URL in browser:
Classic SharePoint Document URL opened using View in Brower:
We’ve focused on the action=view portion as that’s what we were looking for. Because we are not necessarily using “out of the box” functionality we can swap out the action=default for action=view and “force” the documents opened from our kiosk application to open in read-only regardless of the user’s permission levels. While this may not be a solid solution for everyone, it hits the mark for our needs😉.