SharePoint introduced Share buttons to make it easy for users to quickly share a site, folder or document. This introduced several administration, security and governance problems for administrators. Mostly because the act of sharing a document breaks inheritance on the file. Whether this is "evil" or not depends on the way you need to use SharePoint.
Here's a sample flow:
- We have a library for 100 sales documents. Currently the Sales Managers group and five other users have access to the library and its contents.
- Someone clicks the Share button on a document.
- If the user is not an owner and does not have the Manage Lists permission, then a request is added to the Site Owners. Site Owners, if they ever discover the request, can approve or reject it.
- Inheritance is broken on the document. Existing permissions are copied to the file. The user is added to the document's permissions list.
- Now the fun begins…
- A new user or group is given permissions to the library.
- They only see 99 documents! (The missing document has unique permissions and no longer inherits permissions from the library.)
After inheritance is broken you have to remember to manage the permissions of each individual broken inheritance document. Now think about 50 libraries, each with where the Share button has been clicked on a 1000 documents. Job security at the minimum!
Just how many Share buttons are there?
(Let me count the ways…)
The Share the site button:
The Share a document button in the "QCB" (Quick Control Block?) bar:
The Share a document button in the FILES ribbon :
The Share a document button in the "…" pop out:
The Share a document link in the "… …" menu:
The INVITE PEOPLE button in create a new folder:
The Invite People button in the Shared With dialog box:
Did I miss any?
(I started on this article a few times, but each time I found yet another Share button!)
Disabling using Views
You can hide the Share button that's just above the library by switching to any other view style than"Default". This also hides all of the other links in the "QCB" (Quick Control Block?) bar.
The Share button will be grayed out in the FILE ribbon if you select a Style other than Default and Shaded, or disable "Tabular View - Allow individual item checkboxes".
Disadvantages? These styles do not display a checkbox, even if "Tabular View - Allow individual item checkboxes" is checked. Without the checkbox most of the options in the FILE ribbon are disabled.And… this approach only hides one of the Share buttons.
Disabling the Share buttons using CSS
The easiest way, at least until Microsoft gives us an option to turn them off, is to add CSS to the Master Page. Some of the buttons has convenient IDs while some can be found using a class. While you could merge all of the selectors into one line, I broke them out so you could choose which Share features you would like to hide or keep.
In my project I uploaded the CSS file to the Site Assets library. You could place the CSS file in any library where your users have at least read access, or in the layouts folder on the server. You would then link to the file something like this:
<link rel="stylesheet" type="text/css" href="https://yourServer/sites/yourSite/SiteAssets/nosharebuttons.css"></link>
Or maybe:
<link rel="stylesheet" type="text/css" href="/_layouts/nosharebuttons.css"></link>
The CSS:
/* CSS to hide the various Share buttons and links */ /* from TechTrainingNotes.blogspot.com */ /* Use at your own risk. Batteries not included. */ /* Hide Site Share button (page top right) */ #ctl00_site_share_button { display:none !important; } /* Hide library toolbar (QCB) Share button */ .js-listview-qcbShareButton { display:none !important; } /* Hide the Share in the ... popout */ .js-callout-actionsMain span:nth-child(2) { display:none !important; } /* Hide the Share in the ... ... menu */ a[title="Share"] { display:none !important; } /* Hide the INVITE PEOPLE button in Create Folder */ #csfd_invitePeopleBtn { display:none !important; } /* Hide the Share button in the FILES ribbon */ #Ribbon\.Documents\.Share\.ShareItem-Large { display:none !important; } /* Hide the Invite People button in the Shared With dialog */ #lnkShrItem { display:none !important; }
Here's the "one line" version:
/* CSS to hide the various Share buttons and links */ /* from TechTrainingNotes.blogspot.com */ /* Use at your own risk. Batteries not included. */ #ctl00_site_share_button, .js-listview-qcbShareButton, .js-callout-actionsMain span:nth-child(2), a[title="Share"], #csfd_invitePeopleBtn, #Ribbon\.Documents\.Share\.ShareItem-Large, #lnkShrItem { display:none !important; }
.