0

I'm trying to hide the "Upload Document" button (including the Upload Document and Upload Multiple Documents submenu). I've tried the following XML, but I can't get it to work:

  <CustomAction
    Id="RemoveRibbonButton"
    Location="CommandUI.Ribbon">
    <CommandUIExtension>
      <CommandUIDefinitions>
        <CommandUIDefinition
          Location="Ribbon.Documents.New.AddDocument" />
      </CommandUIDefinitions>
    </CommandUIExtension>
  </CustomAction>
  <CustomAction
    Id="RemoveRibbonButton"
    Location="CommandUI.Ribbon"
    RegistrationId="0x0101" 
    RegistrationType="ContentType">
    <CommandUIExtension>
      <CommandUIDefinitions>
        <CommandUIDefinition
          Location="Ribbon.Documents.New.AddDocument" />
      </CommandUIDefinitions>
    </CommandUIExtension>
  </CustomAction>

Doing this removes the submenu, but makes the "New Folder" button, which I also have hidden, reappear:

<CustomAction
    Id="RemoveRibbonButton"
    Location="CommandUI.Ribbon"
    RegistrationId="0x0101" 
    RegistrationType="ContentType">
    <CommandUIExtension>
      <CommandUIDefinitions>
        <CommandUIDefinition
          Location="Ribbon.Documents.New.AddDocument.Menu.Upload" />
      </CommandUIDefinitions>
    </CommandUIExtension>
  </CustomAction>

I want this button hidden because we have made our own file upload control and button and we no longer want the default SharePoint one to display.

EDIT: Just to clarify, I need the solution to be via XML. All of our Ribbon customizations are via XML, so using server-side code or CSS/JavaScript is not an option.

1

You can do this using the SPRibbon class: http://www.3guysonsharepoint.com/?p=778

If you wish to remove multiple uploads use

Ribbon.Documents.New.AddDocument.Menu.Upload.UploadMultiple

The following is a walkthrough for Removing a Button from the Server Ribbon: http://msdn.microsoft.com/en-us/library/ff408060.aspx

Or, alternatively, you can use a css trick to hide them: http://www.patricktalmadge.com/2011/04/09/hide-multiple-upload-link-in-sharepoint-2010/

  • Thanks, but as you can obviously tell from my XML, I know how to remove a button from the ribbon. My question is how to remove this particular button via XML. Doing it through code is not an option because all of my other ribbon customizations are already XML based. – MgSam Aug 24 '12 at 12:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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