Skip to content

Instantly share code, notes, and snippets.

@botatooo
Last active June 8, 2023 02:04
Show Gist options
  • Save botatooo/8221076f7f1acf922a9063fbd64436f4 to your computer and use it in GitHub Desktop.
Save botatooo/8221076f7f1acf922a9063fbd64436f4 to your computer and use it in GitHub Desktop.
because you don't want to accidentally edit a reference document a teacher forgot to mark as view-only and have your name appear on the Modified-By List of Shame™ - Userscript
// ==UserScript==
// @name Don't Edit Documents from Teams
// @version 1
// @include https://*.sharepoint.com/*
// @grant none
// ==/UserScript==
const searchParams = new URLSearchParams(location.search)
if (searchParams.get("wdOrigin") === "TEAMS-ELECTRON.teamsSdk.openFilePreview" && searchParams.get("action") === "edit") {
searchParams.set("action", "view")
location.search = searchParams.toString()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment