Question

I need to remove 'Upload Document' button from the Ribbon on a Document Set library, with the toolbar set to "None".

I can successfully remove it from the Full Toolbar (which is the default one) deploying an elements.xml that overwrites the CommandUIDefinition.

<Elements xmlns="http://schemas.microsoft.com/sharepoint/"> 
 <CustomAction Id="RemoveUploadRibbon" Location="CommandUI.Ribbon" RegistrationType="List" RegistrationId="10001">
  <CommandUIExtension>
   <CommandUIDefinitions>
    <CommandUIDefinition Location="Ribbon.Documents.New.AddDocument">
    </CommandUIDefinition>
   </CommandUIDefinitions>
  </CommandUIExtension>
 </CustomAction>
</Elements>

But whenever I change the toolbar to "None" the button reappears.

It seems that the button is removed only from the default toolbar but not from all the others.

Is there a proper way to remove the button from every toolbar, or at least from a specific one?

Was it helpful?

Solution

First of all there is no document set library in SharePoint. There is only a content type that is called "Document Set" and this can exists on certain document libraries. You need in to use in your declaration the RegistrationType="ContentType" and for the RegistrationId="0x0120D520". Last one is the id of the content Type "Document Set".

The required custom action looks like this:

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

After you the deployment the ribbon should look like this: enter image description here

You will find a complete reference to all ribbon locations in the following link: http://msdn.microsoft.com/en-us/library/ee537543.aspx

OTHER TIPS

You should declare body of CommandUIDefinition tag, use this code instead of your:

<CustomAction Id="{B3B7E731-A378-4823-ABCE-C0261ED41A23}"
                Location="CommandUI.Ribbon"
                RegistrationType="List" RegistrationId="10001">
    <CommandUIExtension>
      <CommandUIDefinitions>
        <CommandUIDefinition Location="Ribbon.ListItem.New"></CommandUIDefinition>
        <CommandUIDefinition Location="Ribbon.ListItem.Manage">
          <Group
            Id="Ribbon.ListItem.Manage"
            Sequence="20"
            Command="ListItemManageGroup"
            Description=""
            Title="$Resources:core,GrpManage;"
            Image32by32Popup="/_layouts/$Resources:core,Language;/images/formatmap32x32.png" Image32by32PopupTop="-64" Image32by32PopupLeft="-448"
            Template="Ribbon.Templates.Flexible2"
          >
            <Controls Id="Ribbon.ListItem.Manage.Controls">
              <Button
                Id="Ribbon.ListItem.Manage.ViewProperties"
                Sequence="10"
                Command="ViewProperties"
                Image16by16="/_layouts/$Resources:core,Language;/images/formatmap16x16.png" Image16by16Top="-32" Image16by16Left="-80"
                Image32by32="/_layouts/$Resources:core,Language;/images/formatmap32x32.png" Image32by32Top="-96" Image32by32Left="-448"
                LabelText="$Resources:core,cui_ButViewItem;"
                ToolTipTitle="$Resources:core,cui_ButViewItem;"
                ToolTipDescription="$Resources:core,cui_STT_ButViewItem;"
                TemplateAlias="o1"
              />
              <Button
                 Id="Ribbon.ListItem.Manage.ViewVersions"
                 Sequence="30"
                 Command="ViewVersions"
                 Image16by16="/_layouts/$Resources:core,Language;/images/formatmap16x16.png" Image16by16Top="-48" Image16by16Left="-80"
                 Image32by32="/_layouts/$Resources:core,Language;/images/formatmap32x32.png" Image32by32Top="-64" Image32by32Left="-448"
                 LabelText="$Resources:core,cui_ButVersionHistory;"
                 ToolTipTitle="$Resources:core,cui_ButVersionHistory;"
                 ToolTipDescription="$Resources:core,cui_STT_ButItemVersionHistory;"
                 TemplateAlias="o2"
              />
              <Button
                 Id="Ribbon.ListItem.Manage.ManagePermissions"
                 Sequence="40"
                 Command="ManagePermissions"
                 Image16by16="/_layouts/$Resources:core,Language;/images/formatmap16x16.png" Image16by16Top="-128" Image16by16Left="0"
                 Image32by32="/_layouts/$Resources:core,Language;/images/formatmap32x32.png" Image32by32Top="0" Image32by32Left="-416"
                 LabelText="$Resources:core,cui_ButItemPermissions;"
                 ToolTipTitle="$Resources:core,cui_ButItemPermissions;"
                 ToolTipDescription="$Resources:core,cui_STT_ButItemPermissions;"
                 TemplateAlias="o2"
              />
              <Button
                Id="Ribbon.ListItem.Manage.Delete"
                Sequence="50"
                Command="Delete"
                Image16by16="/_layouts/$Resources:core,Language;/images/formatmap16x16.png" Image16by16Top="-112" Image16by16Left="-224"
                Image32by32="/_layouts/$Resources:core,Language;/images/formatmap32x32.png" Image32by32Top="-128" Image32by32Left="-128"
                LabelText="$Resources:core,cui_ButDeleteItem;"
                ToolTipTitle="$Resources:core,cui_ButDeleteItem;"
                ToolTipDescription="$Resources:core,cui_STT_ButDeleteItem;"
                TemplateAlias="o2"
              />
            </Controls>
          </Group>
        </CommandUIDefinition>
        <CommandUIDefinition Location="Ribbon.ListForm.Display.Manage">
          <Group Id="Ribbon.ListForm.Display.Manage"
                 Sequence="10"
                 Command="Ribbon.ListForm.Display.ManageGroup"
                 Description=""
                 Title="$Resources:core,GrpManage;"
                 Image32by32Popup="/_layouts/$Resources:core,Language;/images/formatmap32x32.png" Image32by32PopupTop="-128" Image32by32PopupLeft="-96"
                 Template="Ribbon.Templates.Flexible2" >
            <Controls Id="Ribbon.ListForm.Display.Manage.Controls">
              <Button
                Id="Ribbon.ListForm.Display.Manage.EditSeries"
                Sequence="20"
                Command="Ribbon.ListForm.Display.Manage.EditSeries"
                Image16by16="/_layouts/$Resources:core,Language;/images/formatmap16x16.png" Image16by16Top="-160" Image16by16Left="-160"
                Image32by32="/_layouts/$Resources:core,Language;/images/formatmap32x32.png" Image32by32Top="-192" Image32by32Left="-320"
                LabelText="$Resources:core,cui_ButListFormDisplayEditSeries;"
                ToolTipTitle="$Resources:core,cui_ButListFormDisplayEditSeries;"
                ToolTipDescription="$Resources:core,cui_STT_ButListFormDisplayEditSeries;"
                TemplateAlias="o1"/>
              <Button
                Id="Ribbon.ListForm.Display.Manage.VersionHistory"
                Sequence="30"
                Command="Ribbon.ListForm.Display.Manage.VersionHistory"
                Image16by16="/_layouts/$Resources:core,Language;/images/formatmap16x16.png" Image16by16Top="-48" Image16by16Left="-80"
                Image32by32="/_layouts/$Resources:core,Language;/images/formatmap32x32.png" Image32by32Top="-64" Image32by32Left="-448"
                LabelText="$Resources:core,cui_ButVersionHistory;"
                ToolTipTitle="$Resources:core,cui_ButVersionHistory;"
                ToolTipDescription="$Resources:core,cui_STT_ButItemVersionHistory;"
                TemplateAlias="o2"/>
              <Button
                Id="Ribbon.ListForm.Display.Manage.ManagePermissions"
                Sequence="40"
                Command="Ribbon.ListForm.Display.Manage.ManagePermissions"
                 Image16by16="/_layouts/$Resources:core,Language;/images/formatmap16x16.png" Image16by16Top="-128" Image16by16Left="0"
                 Image32by32="/_layouts/$Resources:core,Language;/images/formatmap32x32.png" Image32by32Top="0" Image32by32Left="-416"
                LabelText="$Resources:core,cui_ButListFormDisplayManagePermissions;"
                ToolTipTitle="$Resources:core,cui_ButListFormDisplayManagePermissions;"
                ToolTipDescription="$Resources:core,cui_STT_ButItemPermissions;"
                TemplateAlias="o2"/>
              <Button
                Id="Ribbon.ListForm.Display.Manage.DeleteItem"
                Sequence="50"
                Command="Ribbon.ListForm.Display.Manage.DeleteItem"
                Image16by16="/_layouts/$Resources:core,Language;/images/formatmap16x16.png" Image16by16Top="-112" Image16by16Left="-224"
                Image32by32="/_layouts/$Resources:core,Language;/images/formatmap32x32.png" Image32by32Top="-128" Image32by32Left="-128"
                LabelText="$Resources:core,cui_ButDeleteItem;"
                ToolTipTitle="$Resources:core,cui_ButDeleteItem;"
                ToolTipDescription="$Resources:core,cui_STT_ButListFormDeleteItem;"
                TemplateAlias="o2"/>
            </Controls>
          </Group>
        </CommandUIDefinition>
      </CommandUIDefinitions>
    </CommandUIExtension>
  </CustomAction>

As can you see this is a copy-past of default declaration, but I missed the upload button (may be not only upload) :)

Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top