I have a sharepoint standard view , i want to hide "export excel" ribbon button by permission Ex: i have 2 custom site permssison (A and B), and i want to hide "export excel" ribbon button with user have A permssion Thanks

1 Answer 1


You can use the SPRibbon.TrimById(controlId) method to hide controls.

You can use other OM methods to determine the user's permission and call the TrimById method accordingly. For example, you could use DoesUserHavePermissions on the page's list item:


For all working code you can refer : http://www.gauravgat.com/2011/02/hiding-buttonscontrols-on-sharepoint.html


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.