How to Disable the SharePoint Embed Code Button to Protect Documents
Question details
The user wants to disable the Embed Code button at the site or tenant level to prevent users with restricted viewing permissions from copying it and sharing proprietary documents.

- Product
- SharePoint Online
- Device & OS
- not provided
- Scenario
- Attempting to protect proprietary and sensitive documents on a SharePoint site from unauthorized embedding or sharing.
- Observed behavior
- Users with restricted viewing permissions can still see and copy the Embed Code option, and SharePoint lacks a native toggle to disable this.
Ensure you have Site Administrator or Tenant Administrator privileges so you can review existing sharing controls and permission levels for your SharePoint environment.
Review Site Permissions and Request Feature from Microsoft
Since SharePoint Online does not offer an out-of-the-box setting to disable the Embed Code button, you must rely on strict document permissions to protect content and submit a feature request.
Currently, SharePoint Online does not provide a native setting to disable or hide the Embed Code button at either the site or tenant level.
To protect sensitive content, you must rely on strict document permissions, Information Barriers, or Sensitivity Labels. Keep in mind that even if a user copies the embed code, anyone trying to view the embedded document elsewhere will still be prompted to authenticate and must have the appropriate permission to view it.
Go to your SharePoint Admin Center, select 'Policies', and then click on 'Sharing' to ensure external sharing is restricted to the appropriate levels for your organization.
Navigate to the specific document library on your site. Click the gear icon for Settings, select 'Library settings', click 'More library settings', and choose 'Permissions for this document library' to remove unnecessary user groups or assign 'Restricted View'.
Navigate to the Microsoft Feedback Portal (feedbackportal.microsoft.com) for SharePoint and submit a formal feature request to allow tenant admins to disable the Embed Code button.

Secure Your Local Documents with WPS Office
If you are struggling with SharePoint's online access controls for sensitive files, consider managing your proprietary documents locally. WPS Office is a free, lightweight Microsoft Office alternative that allows you to easily set robust document passwords and encryption for Word, Excel, and PDF files without relying on complex cloud permissions.

Frequently Asked Questions
Can I use custom CSS or scripts to hide the Embed Code button in SharePoint Online?
In modern SharePoint Online sites, injecting custom CSS or scripts to hide native UI elements like the Embed Code button is heavily restricted and not officially supported by Microsoft, unlike in older classic SharePoint sites.
Does restricting a user to 'View Only' prevent them from accessing the Embed Code?
No. Users with 'View Only' permissions can still access and copy the Embed Code. However, anyone attempting to view the embedded document on another site will still need the appropriate SharePoint permissions to see the content.
How can I prevent users from downloading or printing my proprietary SharePoint documents?
You can assign the 'Restricted View' permission level or apply Microsoft Purview Sensitivity Labels. This allows users to view documents in the web browser but removes their ability to download, print, or sync the files.




