locked
CustomActionGroup on StandardMenu

    Question

  • Is it possible to add a new custom action group on StandardMenu ( Microsoft.SharePoint.StandardMenu ), for example something like 'Bulk Actions'.

    So for a default doc library, menu would look like: New -- Upload -- Actions -- Bulk Actions -- Settings.

    Thanks.


    MCTS,MCPD,MCITP,MCT http://zieglers.wordpress.com/
    Thursday, March 18, 2010 8:03 PM

Answers

  • Hi,

              

           Generally, you can create a custom toolbar menus inherit from ToolBarMenuButton with server code.

           You can refer the sample in this post below:

           http://social.technet.microsoft.com/Forums/en-US/sharepointdevelopment/thread/238a2925-6266-4ead-ad78-553b16e49c31

           After deploying the solution in GAC, you can simply change the toolbar template definition in DefaultTemplates.ascx

           (in Drive:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\CONTROLTEMPLATES)

           e.g. If you wish to modify menu for document library, change the like this:

           --------------------------------------------------------------------------------------------------------------------------------------------------------------

    <%@ Register assembly="You assembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=Your Token" namespace="Your Name Space" tagprefix="customMenu" %>

     

            <SharePoint:RenderingTemplate ID="DocumentLibraryViewToolBar" runat="server">

               <Template>

                <wssuc:ToolBar CssClass="ms-menutoolbar" EnableViewState="false" id="toolBarTbl" ButtonSeparator="<img src='/_layouts/images/blank.gif' alt=''>" RightButtonSeparator="&nbsp;&nbsp;" runat="server">

                      <Template_Buttons>

                            <SharePoint:NewMenu AccessKey="<%$Resources:wss,tb_NewMenu_AK%>" runat="server"/>

     

                            <customMenu:MyMenu runat="server" />

     

                            <SharePoint:UploadMenu AccessKey="<%$Resources:wss,tb_UploadMenu_AK%>" runat="server"/>

                            <SharePoint:ActionsMenu AccessKey="<%$Resources:wss,tb_ActionsMenu_AK%>" runat="server"/>

                            <SharePoint:SettingsMenu AccessKey="<%$Resources:wss,tb_SettingsMenu_AK%>" runat="server"/>

                      </Template_Buttons>

                      <Template_RightButtons>

                              <SharePoint:PagingButton runat="server"/>

                              <SharePoint:ListViewSelector runat="server"/>

                      </Template_RightButtons>

                </wssuc:ToolBar>

             </Template>

    </SharePoint:RenderingTemplate>

     

               --------------------------------------------------------------------------------------------------------------------------------------------------------------

     

               More reference : Creating a custom menu with custom control template for listview webpart

               http://graegert.com/programming/adding-a-toolbar-to-custom-list-views

     

              Hope this can help.

     

     Best Regards,

     Aaron

     TechNet Subscriber Support in forum

     If you have any feedback on our support, please contact tngfb@microsoft.com

    • Marked as answer by Chengyi Wu Friday, March 26, 2010 8:23 AM
    Tuesday, March 23, 2010 9:21 AM

All replies

  • Thanks for the links. However, those do not quite answer my question. I don't see anywhere usage of <CustomActionGroup>. I need a custom group there which will hold bulk actions (say bulk delete, bulk approve ...etc.), not a static link. (not control, not a link to a custom application page).

    Nothing different, just like New, Upload, Actions Menus (with a drop-down fashion). Exactly same behaviour. All I need is another group element there..

    zieglers


    MCTS,MCPD,MCITP,MCT http://zieglers.wordpress.com/
    Friday, March 19, 2010 8:50 PM
  • Check this, I am sure this will fulfill your requirement.

    http://www.as-tech.co.uk/post/Adding-menu-item-to-single-list.aspx#comment


    Ashish Kanoongo, MCP, MCSD, MCTS
    Saturday, March 20, 2010 6:46 AM
  • Ashish,

    Although i'm explaining the requirement very specifically above, what you sent is nothing new but creating a custom action item only in one of four menus, which are new menu, upload menu, actions menu and settings menu.

    Once again, what i am asking is - how to create another menu - custom actions group - in StandardMenu toolbar there in lists?

    A new one, 5th one, which will hold custom actions underneath..

    If anyone has done this before, I'll be glad if you can share.. If not, kindly please do not reply with links related to creating custom actions only.

     


    MCTS,MCPD,MCITP,MCT http://zieglers.wordpress.com/
    Monday, March 22, 2010 2:21 AM
  • Hi,

              

           Generally, you can create a custom toolbar menus inherit from ToolBarMenuButton with server code.

           You can refer the sample in this post below:

           http://social.technet.microsoft.com/Forums/en-US/sharepointdevelopment/thread/238a2925-6266-4ead-ad78-553b16e49c31

           After deploying the solution in GAC, you can simply change the toolbar template definition in DefaultTemplates.ascx

           (in Drive:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\CONTROLTEMPLATES)

           e.g. If you wish to modify menu for document library, change the like this:

           --------------------------------------------------------------------------------------------------------------------------------------------------------------

    <%@ Register assembly="You assembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=Your Token" namespace="Your Name Space" tagprefix="customMenu" %>

     

            <SharePoint:RenderingTemplate ID="DocumentLibraryViewToolBar" runat="server">

               <Template>

                <wssuc:ToolBar CssClass="ms-menutoolbar" EnableViewState="false" id="toolBarTbl" ButtonSeparator="<img src='/_layouts/images/blank.gif' alt=''>" RightButtonSeparator="&nbsp;&nbsp;" runat="server">

                      <Template_Buttons>

                            <SharePoint:NewMenu AccessKey="<%$Resources:wss,tb_NewMenu_AK%>" runat="server"/>

     

                            <customMenu:MyMenu runat="server" />

     

                            <SharePoint:UploadMenu AccessKey="<%$Resources:wss,tb_UploadMenu_AK%>" runat="server"/>

                            <SharePoint:ActionsMenu AccessKey="<%$Resources:wss,tb_ActionsMenu_AK%>" runat="server"/>

                            <SharePoint:SettingsMenu AccessKey="<%$Resources:wss,tb_SettingsMenu_AK%>" runat="server"/>

                      </Template_Buttons>

                      <Template_RightButtons>

                              <SharePoint:PagingButton runat="server"/>

                              <SharePoint:ListViewSelector runat="server"/>

                      </Template_RightButtons>

                </wssuc:ToolBar>

             </Template>

    </SharePoint:RenderingTemplate>

     

               --------------------------------------------------------------------------------------------------------------------------------------------------------------

     

               More reference : Creating a custom menu with custom control template for listview webpart

               http://graegert.com/programming/adding-a-toolbar-to-custom-list-views

     

              Hope this can help.

     

     Best Regards,

     Aaron

     TechNet Subscriber Support in forum

     If you have any feedback on our support, please contact tngfb@microsoft.com

    • Marked as answer by Chengyi Wu Friday, March 26, 2010 8:23 AM
    Tuesday, March 23, 2010 9:21 AM
  • Thanks for the reply. I was able to create my custom toolbar menu by following the sample you provided. However, this technique involves modifying OOTB DefaultTemplates.ascx file, which is a concern in terms of deployment and supportability.

    Is there any way to to handle DefaultTemplates.ascx modification by code?


    MCTS,MCPD,MCITP,MCT http://zieglers.wordpress.com/
    Friday, March 26, 2010 7:33 PM
  • Hi, zieglers

              

              Thanks for your feedback!

              Yes, as you mentioned, if you implement this solution, you have to modify the file in 12 hive.

              So this get us into the dilemma----we need to define or customize some global definition, at the same time we have to comply with upgrade policy.

              Base on my knowledge, the both following directions could be possible choice.

    A.      Make a backup of OOB DefaultTemplates.ascx then achieve this with solution above.

     

    B.      If you need to modify menu items for some specific lists, you can change these list OOB listview webpart to DataForm webpart in SharePoint Designer.

    In DataForm xlt definition, you can register your custom menu control, then replace the OOB New,Action,Setting Menu.

    In this scenario, you can do customization at “control level” instead of “template level”, which would be more safe.

    Some Tips for this:

    ·         You should register the control in SPD like this following:

    <%@ Register TagPrefix="Your Tag" Assembly="You Assembly " namespace="Your Name Space" %> .

    Replace the <SharePoint: NewMenu /> to your menu control <Your Tag:CustomerViewMenu runat="server" />

     

    ·         Also need to add definition in web.config

      <pages enableSessionState="true" enableViewState="true" enableViewStateMac="true" validateRequest="false" pageParserFilterType="Microsoft.SharePoint.ApplicationRuntime.SPPageParserFilter, Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" asyncTimeout="7">

          <controls>

            <add tagPrefix=" Your Tag" namespace=" Your Name Space" assembly=" You Assembly" />

          </controls>

        </pages>

     

     

                    Hope this can help.

     

     Best Regards,

     Aaron

     TechNet Subscriber Support in forum

     If you have any feedback on our support, please contact tngfb@microsoft.com

    Monday, March 29, 2010 9:16 AM
  • Hey,

     

    That's works for me too, but now I want to add new CustomActions to my custom toolbar menu but I don't know whitch GroupId and Location must I choose?

    Example: if you want to add new CustomAction to Actions menu, you choose GroupId="ActionsMenu" and Location="Microsoft.SharePoint.StandardMenu".

     

    Well, how can I add CustomAction in my custom toolbar menu? I know that the one way is to put them there by code in class, but sometimes I want to add one new (in other feature) through the elements.xml

     

    Thanks!

    Luky

    Thursday, May 27, 2010 8:52 AM