Introduction

Sometimes you create a List/Document Library using Visual Studio and you need to hide ‘Export to Excel’ button from Ribbon. You do not want to do it using SharePoint Designer because you have to do it manually in all the environments. Using this JavaScript approach hide this button from Ribbon.

Implementation

We are going to customize the List View using JavaScript.

  1. Add a JavaScript file in your solution.
  2. Modify schema.xml of the List and add the reference of JavaScript file to the <JSLink> tag.

Get Started:

Additional Note

You can use developer tool to get the Id of the span which contains ‘Export to Excel’ button. It is different in Document Library AllItems view.

code

Conclusion

This method can be used to hide any button or Document element on All items View page. If you have more than one view on the List/Library, you can use the same JavaScript file hide any element. Achieve additional customization in List View using custom JavaScript.