Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I want to hide "start workflow" menu with hidecustomaction This example is from a sharepoint book.

<HideCustomAction Id="RemoveRibbonButton"
    Location="CommandUI.Ribbon.Library.Actions.ConnectToClient">
</HideCustomAction>

"Start Workflow" has id="Ribbon.List.Settings.ManageWorkflows.Menu.Manage.Associate-Menu" So I have tried:

<HideCustomAction Id="RemoveRibbonButton"
      Location="CommandUI.Ribbon.List.Settings.ManageWorkflows.Menu.Manage.Associate-Menu">
</HideCustomAction>

What location is it?

share|improve this question
add comment

2 Answers 2

up vote 6 down vote accepted

Ribbon buttons cannot be hidden using HideCustomAction, at all. At least, I've tried this and it doesn't work.

You should use CustomAction for this purpose, with empty CommandUIDefinition elements, like this:

<CustomAction
 Id="RemoveRibbonButton"
 Location="CommandUI.Ribbon"
>
  <CommandUIExtension>
    <CommandUIDefinitions>
     <CommandUIDefinition Location="Ribbon.EditingTools.CPEditTab.Styles" />
    </CommandUIDefinitions>
  </CommandUIExtension>
</CustomAction>

This approach was tested many times and works like a charm.

But in your particular situation, this method won't work. The point here is that Manage Workflows is a SplitButton, and it's items are populated dynamically through the javascript. And the menu is hardcoded into javascript.

So, you can easily hide the whole Manage Workflows SplitButton, passing "Ribbon.List.Settings.ManageWorkflows" to the CommandUIDefinition element location. But to hide one of menu items, you ought to do a lot of work.

Actually, you should replace OOTB Manage Workflows SplitButton with your own, and write your own script, which returns the whole dynamic menu XML code.

Or, you can choose to refuse dynamic functionality, and deal with static menu approach - actually it is much easier and I recommend you to start with it, although I have the ready-to-use solution for dynamic menu.

The whole code:

<CustomAction Id="RemoveAddWorkflowMenuItem" Location="CommandUI.Ribbon">
  <CommandUIExtension>
    <CommandUIDefinitions>
      <CommandUIDefinition Location="Ribbon.List.Settings.ManageWorkflows">
        <SplitButton
          Id="Ribbon.List.Settings.ManageWorkflows"
          Sequence="30"
          Command="ManageWorkflows"
          Image16by16="/_layouts/$Resources:core,Language;/images/formatmap16x16.png" Image16by16Top="-112" Image16by16Left="-112"
          Image32by32="/_layouts/$Resources:core,Language;/images/formatmap32x32.png" Image32by32Top="-160" Image32by32Left="-416"
          LabelText="$Resources:core,cui_ButManageWorkflow;"
          MenuAlt="$Resources:core,cui_ButManageWorkflow;"
          ToolTipTitle="$Resources:core,cui_ButManageWorkflow;"
          ToolTipDescription="$Resources:core,cui_STT_ButListManageWorkflow;"
          TemplateAlias="o2"
          PopulateDynamically="false"
                    >
          <Menu Id="Ribbon.List.Settings.ManageWorkflows.Menu">
            <MenuSection DisplayMode="Menu" Id="Ribbon.List.Settings.ManageWorkflows.Menu.Manage">
              <Controls Id="Ribbon.List.Settings.ManageWorkflows.Menu.Manage.Controls">
                <Button Id="Ribbon.List.Settings.ManageWorkflows.Menu.Manage.EditSettings" Command="EditWorkflowSettings" MenuItemId="Ribbon.List.Settings.ManageWorkflows.Menu.Manage.WorkflowSettings.Menu" LabelText="Workflow Settings"/>
              </Controls>
            </MenuSection>
            <MenuSection DisplayMode="Menu" Id="Ribbon.List.Settings.ManageWorkflows.Menu.CreateInSP">
              <Controls Id="Ribbon.List.Settings.ManageWorkflows.Menu.CreateInSP.Controls">
                <Button Id="Ribbon.List.Settings.ManageWorkflows.Menu.CreateInSP.CreateWorkflowInDesigner" Command="CreateWorkflowInDesigner" LabelText="Create a Workflow in SharePoint Designer"/>
                <Button Id="Ribbon.List.Settings.ManageWorkflows.Menu.CreateInSP.CreateReusableWorkflowInDesigner" Command="CreateReusableWorkflowInDesigner" LabelText="Create a Reusable Workflow in SharePoint Designer"/>
              </Controls>
            </MenuSection>
          </Menu>
        </SplitButton>
      </CommandUIDefinition>

    </CommandUIDefinitions>
  </CommandUIExtension>
</CustomAction>

Screenshot of the customized splitbutton:

screenshot of Manage Workflow button after customizations

P.S. If you often work with SharePoint Ribbon, I would recommend you to check out my open source project SharePoint 2010 Fluent Ribbon API, which simplifies ribbon creation and customization. It is completely free and licensed under Ms-PL.

share|improve this answer
    
Thank you very much! It was a good description! Thank you for presenting your open source project. I would like to learn more about ribbon. But for now I solved the problem with css: #Ribbon.List.Settings.ManageWorkflows.Menu.Manage.Associate-Menu { display:none; } –  Anatoly Mironov Aug 30 '11 at 12:39
add comment

Note that the - separates the "id" from the "style", e.g. in the ribbon an action that renders using small icon plus text because of space will be called e.g. "Ribbon.Library.Actions.OpenWithExplorer-Medium"

According to http://msdn.microsoft.com/en-us/library/bb802730.aspx you should apparently use Location="CommandUI.Ribbon" and the further link tells you which id to use; so in theory e.g.

<HideCustomAction Location="CommandUI.Ribbon" HideActionId="Ribbon.Library.Actions.OpenWithExplorer" />

should have worked - if they supported it in ribbons like they do in menus, instead of the "empty custom action" workaround

share|improve this answer
add comment

Your Answer

 
discard

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

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