Hiding the Evil SharePoint 2013 Share Buttons!


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" 

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.   */

  .js-callout-actionsMain span:nth-child(2), 
 display:none !important;




mike bunyan said...

I like this technique. More subtle than some other options like:
Disabling share, follow and syncronize or
Elio Struyf Hiding social actions

Kameron Berget post list of places to find where ‘Share’ webs, libraries and items, like you, Mike, I am not sure it covers all places Share appears.

The point about Site Owners noticing they have an action to decide upon is important to user acceptance. If the Site Collection or Team Site is not regularly monitored or some obscure shared email account is used to send emails for approval, then user frustration is quickly increased.

Mike B

Anonymous said...

Thanks for the tips!

We did it a bit differently though. For us we wanted to block sharing on the MySites to prevent internal data leaks.

If a user tries to share from their personal page they will get the following error - "Sorry, something went wrong. Only a limited set of people are allowed to share this content."

CSS hacks were not required for this as there is a feature that can be disabled in the central admin page.

Central Admin > Manage Web Applications > Highlight your SharePoint - Mysites site > User Permissions

**Uncheck** *Manage Permissions - Create and change permission levels on the Web site and assign permissions to users and groups.*

This will prevent the users from being able to adjust the permissions themselves for files/folders on their MySite.

Karen Esterl said...

Thank you so much for this post. Saved me tons of time and heartache. I found another thing to hide: a[id^="sl-InviteLink"]. I noticed under the "… …" menu that if I clicked "Shared With" there was another "INVITE PEOPLE" button. Every such "INVITE PEOPLE" button on the page had a unique id ending with a system-generated number. But the id always starts with sl-InviteLink. Adding this selector to my CSS seems to have done the trick!

Anonymous said...

And in SharePoint, you click "Share With" even if you want to delete permissions... ^^
Thank you for Sharing this ... ;)

Anonymous said...

with .js-callout-actionsMain span:nth-child(2) {
display:none !important;
you also hide add to timeline in your task list

Mike Smith said...


> you also hide add to timeline in your task list

Do you have a solution?


Jeanne said...

Hi, do you know if Microsoft has intentions on correcting this problem? The broken inheritance thing? Thanks!


Mike Smith said...


I doubt that it will be "fixed" as it is considered to be a feature! :-(


nullldata said...

I found another one for you!


or simply


This is in the "Feed" webpart that says:

"It's pretty quiet here. Invite more people to the site, or start a conversation."

Mike Smith said...


Thanks! And keep them coming!

If they would only give the admins an option to just turn the Share buttons off!


Unknown said...

Thanks for all your help!
Is there a way to disable Share within a Word/Excel document preview?

i'm mostly interested hiding the list of people the document is shared with.

Mike Smith said...

> Is there a way to disable Share within a Word/Excel document preview?

I don't know of a way injecting custom CSS or HTML into the Office Web Apps pages.

If you can find a way, here's the IDs to hide:
Word: #btnFileSharing-Medium20
Excel: #m_excelWebRenderer_ewaCtl_flyoutExcelShare-Medium20
PPT: #PptJewel\.Share\.ShareWithPeople-Medium20


Note to spammers!

Spammers, don't waste your time... all posts are moderated. If your comment includes unrelated links, is advertising, or just pure spam, it will never be seen.