Sign up ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

Can anyone offer advice please as to how i can remove the 'attach file' menu button form the ribbon only on a specific library?

It is on the default new + edit forms that are loaded ... It needs to be a deployable solution.. ie: I cant just edit in designer ..

I think the way to go is a HideCustomAction .. but i cant seem to get it to work.

This is on Sharepoint 2010 and im using visual studio 2010.

Many thanks all.


share|improve this question

2 Answers 2

You should be able to set the SPList.EnableAttachments value to false...

You can also try the code found at :, this looks like inline javascript that you can call from your master page or page layout if you are deploying custom forms for the list.

function HideButton()
 var tags = document.getElementsByTagName('a');

 for (var i=0; i < tags.length; i++)
     if(tags[i].title == 'Attach File')
         tags[i].style.display = 'none'

     if(tags[i].id == 'ctl00_m_g_1b517923_1f1a_475a_8e10_57a050a1c53a_ctl00_ctl01_ctl00_toolBarTbl_RptControls_diidIOAttach_LinkText')
        tags[i].style.display = 'none'
share|improve this answer
Where would i do this Mauro? Many thanks –  user2388 Mar 9 '11 at 14:23

I have come up with an answer that works for me which is below, I add this to my elements file voila!

          <Location="Ribbon.ListForm.Edit.Actions.AttachFile" />

Your answers where very much valid and appreciated though Mauro

share|improve this answer
Grr .. the xml in the answer wont keep its format .. sorry ... –  user2388 Mar 9 '11 at 14:32

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.