In this post, we will learn how to hide or disable Shared With button from SharePoint Ribbon. Also, we will show how to remove or disable Share menu item in SharePoint Online and SharePoint 2019 / 2016 as shown below.
-
1
Hide/Disable Shared With Button and Share Menu Item in SharePoint
- 1.1 How to disable “Shared With” button from SharePoint List Ribbon?
- 1.2 How to hide “Shared With” button from SharePoint List Ribbon?
- 1.3 How to disable “Shared With” button from SharePoint List Items Ribbon?
- 1.4 How to hide “Shared With” button from SharePoint List Items Ribbon?
- 1.5 How to disable “Share” menu item from SharePoint List?
- 1.6 How to disable “Share” menu item from SharePoint List?
- 1.7 How to disable “Shared With” menu item from SharePoint List Menu Item?
- 1.8 How to hide “Shared With” menu item from SharePoint List Menu Item?
- 1.9 How to disable “Shared With” button from SharePoint List Display Form Ribbon?
You might also like to read How to disable Share in SharePoint Document Library?
Consider, you have requested to hide/disable “Shared With” button from SharePoint Ribbon or “Share” list menu item for all users in SharePoint Online Classic Experience and SharePoint 2019 / 2016 as shown below:
So as one of the suggested solutions that NOT worked for me is disallowing Access Request Settings by Opening Site Settings > Site Permissions. > At the above ribbon > Click on Access Request Settings, then Uncheck the below options as shown below:
Actually, Disabling Access Request Settings would helps you to
- Disallow members to share and invite others to this site,
- Disallow access requests to unauthorized members.
- Limit some SharePoint sharing functionality for specific members.
But, it does still an insufficient solution to hide or disable the “Shared With” button from the SharePoint Ribbon or the “Share” Menu Item for all users as shown below:
In SharePoint Online Classic Experience as well as SharePoint Server 2019 / 2016, there is a “Shared With” button in the above ribbon of SharePoint List to can see who has access to this list as shown below:
The simple solution to disable Shared With button from the SharePoint List Ribbon is using a simple CSS code in a Script Editor web part at the AllItems page of the SharePoint List by following the below steps:
Steps
- Open your SharePoint Site.
- Navigate to your list that you would like to disable the “Shared With” button.
- Click on the Settings Gear icon > Edit the Page.
- Click “Add Web Part” > “Media and Content” > Add “Script Editor Web Part” > “Edit Snippet”.
- Copy the below CSS, and paste it to your script editor web part.
//disable Shared With button from the SharePoint List Ribbon
<style>
#Ribbon\.List\.Settings\.ListPermissions-Large,
#Ribbon\.List\.Settings\.ListPermissions-Medium,
#Ribbon\.List\.Settings\.ListPermissions-Small {
pointer-events: none;
opacity: 0.6;
}
</style>
- From the above ribbon, click “Stop Editing Page”.
- Great, the “Shared With” button in the SharePoint List Ribbon has been disabled successfully as shown below.
The above steps applied for SharePoint 2019,2016,2013 and SharePoint Online Classic Experience.
To remove or hide Shared With button from the SharePoint List Ribbon, you should repeat the above steps with the below CSS code.
//Hide Shared With button from the SharePoint List Ribbon
<style>
#Ribbon\.List\.Settings\.ListPermissions-Large,
#Ribbon\.List\.Settings\.ListPermissions-Medium,
#Ribbon\.List\.Settings\.ListPermissions-Small {
display: none;
}
</style>
Great, the “Shared With” button in the SharePoint List Ribbon has been removed successfully as shown below.
Download the full CSS from GitHub, and Please don’t forget to follow me to get the latest updates.
There is also another “Shared With” button in SharePoint List Items Ribbon to can see who can access a specific Item or document as shown below:
To disable the “Shared With” button from the SharePoint List Items Ribbon, we will also use a CSS code in the Script Editor web part at the AllItems page of the SharePoint List by following the below steps:
Steps
- Open your SharePoint Site.
- Navigate to your list that you would like to disable the “Shared With” button in the ribbon Items tab.
- Click on the Right Setting Gear icon > Edit the Page.
- Click “Add Web Part” > “Media and Content” > Add “Script Editor Web Part” > “Edit Snippet”.
- Copy the below CSS, and paste it to your script editor.
//disable Shared With button from SharePoint List Items Ribbon
<style>
#Ribbon\.ListItem\.Manage\.ManagePermissions-Medium {
pointer-events: none;
opacity: 0.6;
}
</style>
- From the above ribbon, click “Stop Editing Page”.
- Great, the “Shared With” button in the SharePoint List Items Ribbon has been disabled successfully as shown below.
For Share Document Library, Please check How to disable Share in SharePoint Document Library?
To hide “Shared With” button from SharePoint List Items Ribbon, you should repeat the above steps with the below CSS code.
//Hide Shared With button from SharePoint List Items Ribbon
<style>
#Ribbon\.ListItem\.Manage\.ManagePermissions-Medium {
display: none;
}
</style>
Great, the “Shared With” button in the SharePoint List Item Ribbon has been removed successfully as shown below. but I think disable this option instead of removing in is the preferred choice.
Download the full CSS from GitHub, and Please don’t forget to follow me to get the latest updates.
In SharePoint online classic experience, and SharePoint 2019, there is a share menu item for each list item to share this item for specific members or groups as shown below:
To disable the “Share” option from SharePoint List Item Menu, we will also use a CSS code in the Script Editor web part at the AllItems page of the SharePoint List by following the below steps:
Steps
- Open your SharePoint Site > Navigate to your list that you would like to disable the “Share” menu item.
- Click on the Right Setting Gear icon > Edit the Page.
- Click “Add Web Part” > “Media and Content” > Add “Script Editor Web Part” > “Edit Snippet”.
- Copy the below CSS, and paste it to your script editor.
//Disable Share menu item from SharePoint List
<style>
.ms-contextmenu-link[title="Share"]
{
pointer-events: none;
opacity: 0.6;
}
</style>
- From the above ribbon, click “Stop Editing Page”.
- Great, the “Share” menu item has been disabled successfully as shown below.
There is no Share menu item option in SharePoint 2013 and SharePoint 2016. only Shared With menu item is available.
To hide “Share” menu item from SharePoint List Items menu, you should repeat the above steps with the below CSS code.
//Hide Share menu item from SharePoint List
<style>
.ms-contextmenu-link[title="Share"]
{
display: none;
}
</style>
Great, the Share menu item has been removed successfully as shown below.
Download the full CSS from GitHub, and Please don’t forget to follow me to get the latest updates.
In SharePoint online classic experience, and SharePoint 2019, there is also a child shared with option below advanced menu item to check who can access this list item, as shown below:
The solution to disable the “Shared With” option from SharePoint List Item Menu, we will also use a CSS code in the Script Editor web part at the AllItems page of the SharePoint List as the following:
Steps
- Open your SharePoint Site > Navigate to your list that you would like to disable the child “Shared With” menu item.
- Click on the Right Setting Gear icon > Edit the Page.
- Click “Add Web Part” > “Media and Content” > Add “Script Editor Web Part” > “Edit Snippet”.
- Copy the corresponding CSS “disable Shared With menu item from SharePoint List” from my GitHub, and paste it to your script editor.
// Disable Shared With menu item from SharePoint List
<style>
.ms-contextmenu-link[title="Shared With"] {
pointer-events: none;
opacity: 0.6;
}
</style>
- From the above ribbon, click “Stop Editing Page”.
- Great, the “Shared With” menu item has been disabled successfully as shown below.
Note: In SharePoint 2016 and SharePoint 2013, the Shared with menu item is shown as a main menu item, not as a child that has a different class name.
So that to disable/hide Shared With SharePoint 2013 / 2016, you should use this CSS code from my GitHub at Disable Shared With Button Ribbon in SharePoint 2016/ 2013.
To hide Shared With menu item from SharePoint List, you should repeat the above steps with the below CSS code.
// Hide Shared With menu item from SharePoint List
<style>
.ms-contextmenu-link[title="Shared With"] {
display: none;
}
</style>
Great, the Shared With menu item has been removed successfully as shown below.
Download the full CSS from GitHub, and Please don’t forget to follow me to get the latest updates.
The last location that you can find the “Shared With” button is the SharePoint List Display Form Ribbon as shown below:
The solution to disable the “Shared With” button from SharePoint List Display Form Ribbon, we will also use a CSS code in the Script Editor web part at the Display Form for a specific item in the SharePoint List as the following:
Steps
- Open your SharePoint Site > Navigate to your list that you would like to disable the “Shared With” button in the Display form.
- In the above ribbon, at List tab > click on Form web part > Default Display Form.
- Click “Add Web Part” > “Media and Content” > Add “Script Editor Web Part” > “Edit Snippet”.
- Copy the corresponding CSS “disable Shared With button from SharePoint List Display Form Ribbon” from my GitHub, and paste it to your script editor.
//Disable Shared With button from SharePoint List Display Form Ribbon
<style>
#Ribbon\.ListForm\.Display\.Manage\.ManagePermissions-Medium {
pointer-events: none;
opacity: 0.6;
}
</style>
- From the above ribbon, click “Stop Editing Page”.
- Great, the “Shared With” button in SharePoint List Display Form Ribbon has been disabled successfully as shown below.
Download
Download the full test code to hide/disable Shared with and share menu item in SharePoint Online and SharePoint from GitHub, and Please don’t forget to follow me to get the latest updates.
Conclusion
In SharePoint, the Access Request Settings will limit some sharing functionality for aspecific users. however, you may need to disable the Shared with button from the List ribbon or menu item for all users. in this case, you should use the above provided solutions to disable Shared with button as per requirements.
See Also
- How to disable Share in SharePoint Document Library?
- Disable SharePoint Field Using JQuery
- Hide Save button from SharePoint Ribbon
- Show / Hide fields based on choice field selection using JQuery in SharePoint 2016
- Show and Hide Columns in SharePoint List Forms Using PowerShell
- SharePoint in Microsoft 365
- Have a question or need clarification, please post it at our QnA deBUG.to Community.