Open Documents Read-Only in Modern SharePoint

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

Modern Open In 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

Classic SharePoint Open In 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:

https://tenant.sharepoint.com/:w:/r/sites/Office365Governance/_layouts/15/Doc.aspx?sourcedoc=%7B45E2C880-8854-4120-A9E7-1D1FA2C3A1EB%7D&file=SharePoint%20Online%20Administrative%20Policies.docx&action=default&mobileredirect=true

Classic SharePoint Document URL opened using View in Brower:

https://tenant.sharepoint.com/:w:/r/sites/Office365Governance/_layouts/15/Doc.aspx?sourcedoc=%7B56BAE41D-7EB1-4436-9A55-EC4E7885690E%7D&action=view&source=https%3A%2F%2Ftenant%2Esharepoint%2Ecom%2Fsites%2FOffice365Governance%2FShared%2520Documents%2FForms%2FAllItems%2Easpx

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😉.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s