Remove “Download a copy” button from the Ribbon

Hi,
After a short break I am back to SharePoint development. This time I decided to do something with JavaScript and jQuery.

Today morning one of my friend came to me with a requirement. She wanted to remove “Download a copy” button from a particular document library. I know that can be done with CustomAction but in her case custom development was not an option. She wanted to achieve this using browser interface only.
I tried to google for a solution but nothing found useful. Then I tried to embed JavaScript on the page with a Content Editor webpart. That also failed because the script was not executed properly since the ribbon loaded dynamically (after the page load, when user selects an item).

Then I decided to try with CSS and there I had success.
Here is what I did:
1. Added a Content Editor webpart to the AllItems.aspx page
2. Added following HTML into the HTML source of CEWP.

a[id$='Ribbon.Documents.Copies.Download-Large'] {
display:none;
}

Some screenshots

About these ads

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s