How to Disable Shared With button in SharePoint 2019 and SharePoint Online?

disable sharing functionality in SharePoint

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.

disable shared with button from SharePoint ribbon in SharePoint Online
Disable shared with button from SharePoint ribbon

You might also like to read How to disable Share in SharePoint Document Library?


Hide/Disable Shared With Button and Share Menu Item in SharePoint

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:

disable sharing in SharePoint List
Shared with button in SharePoint List

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:

disallow access request in SharePoint online
Access Request Settings in SharePoint Online

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:

disable shared with sharepoint

How to disable “Shared With” button from SharePoint List Ribbon?

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:

shared with ribbon button in SharePoint Online

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

  1. Open your SharePoint Site.
  2. Navigate to your list that you would like to disable the “Shared With” button.
  3. Click on the Settings Gear icon > Edit the Page.
edit page in SharePoint Online
  1. Click “Add Web Part” > “Media and Content” > Add “Script Editor Web Part” > “Edit Snippet”.
Add Script Editor Web Part
  1. 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>
  1. From the above ribbon, click “Stop Editing Page”.
  2. Great, the “Shared With” button in the SharePoint List Ribbon has been disabled successfully as shown below.
disable the "Shared With" button from the SharePoint List Ribbon
Disable Shared With button from the SharePoint List Ribbon

The above steps applied for SharePoint 2019,2016,2013 and SharePoint Online Classic Experience.

How to hide “Shared With” button from SharePoint List Ribbon?

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.

remove shared with button ribbon in SharePoint Online
Hide Shared With button from the SharePoint List Ribbon

Download the full CSS from GitHub, and Please don’t forget to follow me to get the latest updates.


How to disable “Shared With” button from SharePoint List Items Ribbon?

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:

"Shared With" button from the SharePoint List Items Ribbon

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

  1. Open your SharePoint Site.
  2. Navigate to your list that you would like to disable the “Shared With” button in the ribbon Items tab.
  3. Click on the Right Setting Gear icon > Edit the Page.
  4. Click “Add Web Part” > “Media and Content” > Add “Script Editor Web Part” > “Edit Snippet”.
  5. 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>
  1. From the above ribbon, click “Stop Editing Page”.
  2. Great, the “Shared With” button in the SharePoint List Items Ribbon has been disabled successfully as shown below.
disable the "Shared With" button from SharePoint List Items Ribbon
Disable Shared With button from SharePoint List Items Ribbon

For Share Document Library, Please check How to disable Share in SharePoint Document Library?

How to hide “Shared With” button from SharePoint List Items Ribbon?

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.

remove shared with button ribbon list items in SharePoint Online
Hide “Shared With” button from SharePoint List Items Ribbon

Download the full CSS from GitHub, and Please don’t forget to follow me to get the latest updates.


How to disable “Share” menu item from SharePoint List?

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:

hide share menu item in SharePoint Online
“Share” option from SharePoint List Menu Item

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

  1. Open your SharePoint Site > Navigate to your list that you would like to disable the “Share” menu item.
  2. Click on the Right Setting Gear icon > Edit the Page.
  3. Click “Add Web Part” > “Media and Content” > Add “Script Editor Web Part” > “Edit Snippet”.
  4. 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>
  1. From the above ribbon, click “Stop Editing Page”.
  2. Great, the “Share” menu item has been disabled successfully as shown below.
disable share menu item in SharePoint Online
Disable Share menu item from SharePoint List

There is no Share menu item option in SharePoint 2013 and SharePoint 2016. only Shared With menu item is available.

How to disable “Share” menu item from SharePoint List?

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.

remove share menu item in SharePoint Online
Remove share menu item in SharePoint Online

Download the full CSS from GitHub, and Please don’t forget to follow me to get the latest updates.

How to disable “Shared With” menu item from SharePoint List Menu Item?

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:

hide shared with menu item in SharePoint Online
Shared With option from SharePoint List Menu Item

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

  1. Open your SharePoint Site > Navigate to your list that you would like to disable the child “Shared With” menu item.
  2. Click on the Right Setting Gear icon > Edit the Page.
  3. Click “Add Web Part” > “Media and Content” > Add “Script Editor Web Part” > “Edit Snippet”.
  4. 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>
  1. From the above ribbon, click “Stop Editing Page”.
  2. Great, the “Shared With” menu item has been disabled successfully as shown below.
disable shared with menu item in SharePoint Online
Disable Shared With menu item from SharePoint online List

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.

Disable Shared With Button Ribbon in SharePoint 2016
Disable Shared With menu item from SharePoint 2016 / 2013

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.

How to hide “Shared With” menu item from SharePoint List Menu Item?

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.

remove shared with menu item in SharePoint 2019

Download the full CSS from GitHub, and Please don’t forget to follow me to get the latest updates.

How to disable “Shared With” button from SharePoint List Display Form Ribbon?

The last location that you can find the “Shared With” button is the SharePoint List Display Form Ribbon as shown below:

hide shared with button ribbon in Display Form
Shared With button in SharePoint List Display Form Ribbon

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

  1. Open your SharePoint Site > Navigate to your list that you would like to disable the “Shared With” button in the Display form.
  2. In the above ribbon, at List tab > click on Form web part > Default Display Form.
default display form in SharePoint Online
  1. Click “Add Web Part” > “Media and Content” > Add “Script Editor Web Part” > “Edit Snippet”.
add script editor in display form to hide shared with button
  1. 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>
  1. From the above ribbon, click “Stop Editing Page”.
  2. Great, the “Shared With” button in SharePoint List Display Form Ribbon has been disabled successfully as shown below.
disable shared with button ribbon in Display Form
Disable Shared With button from SharePoint List Display Form Ribbon

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

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top