Pages

Thursday, September 23, 2010

SharePoint 2010: Add custom menuitem to Welcome/My Settings (top-right) menu

To add a custom menu or hide an existing menu in SharePoint you need associate a element.xml file with a feature. My pervious blog post descries how to add an element.xml file and associate it with a feature. The element.xml file has the following structure:

<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
  <CustomAction
  Id="myCustomAction"
  GroupId="GROUP_ID"
  Location="MENU_LOCATION"
  Sequence="1000"
  Title="Open Your Page"
  Description="Open Your custom page">
    <UrlAction Url="~site/SitePages/mypage.aspx"/>
  </CustomAction>
</Elements>

As shown in the code snippet above, Id is the name of the action. GroupId is the sharepoint defined GroupId and Location is also sharePoint defined location. Sequence will define the sequence number of the menu item. Url Action is the page where user will be navigated when user will click the menu.

To add custom menu item on the welcome or my settings menu, you need to add an element.xml file (shown below) in the project and need to associate the element.xml file with a feature. In my previous blog post I have described how to add an Element.xml file and attach the xml file with a feature.

<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
  <CustomAction
  Id="myCustomAction"
  GroupId="PersonalActions"
  Location="Microsoft.SharePoint.StandardMenu"
  Sequence="1000"
  Title="Open Your Page"
  Description="Open Your custom page">
    <UrlAction Url="~site/SitePages/MyPage.aspx"/>
  </CustomAction>
</Elements>

After using the above Element.xml file you can get the following menu item added on the Welcome/My settings menu.

image

You can get a set of groupid and location values for SharePoint from this MSDN link.

9 comments:

  1. Thank you! Many sites out there claim to have the complete list of Group/Location IDs - but none of them have this - which was exactly what I was looking for.

    ReplyDelete
  2. How do you put the custom action at the top?
    No matter what sequence number I use (even tried 0) it will come after the "sign out" option, which is ridiculous...

    ReplyDelete
  3. The issue might be different. Sometimes the ribbon doesn't get updated even if change the xml file and deploy. Please check my another post: http://ranaictiu-technicalblog.blogspot.com/2011/08/sharepoint-2010-redeploying-ribbon.html

    ReplyDelete
  4. I tried changing the feature version, and clearing my browser cache, but no success.
    The custom menu item stays at the bottom :(

    ReplyDelete
  5. Thanks! This is just what I needed, was done in 2 minutes.

    ReplyDelete
  6. While you may properly possess the talents of designing, somebody does even now should sew the attire to create your technology a reality. Some inside the eye-catching objects stocked up by Isabel Marant Dress. This may properly telephone call for producing a cease with a attire store to evaluation the sewing options for you. This could also provide you with the probability to seek help from straight getting a artist to create any alterations and minor modifications in detail you may properly have overlooked. Your trip will also permit you to definitely compile the advertising price of sewing it. The certainly specific concern concerning the brand brand is its ability to stand out by method of the crowd with its one-of-a-kind design & desire collection. Sizes, colors, styles and prints are plentiful & plethoric!
    cccccxxzzdf isabel marant cuba boot

    ReplyDelete
  7. how to add menu item under list settings --> under permissions section.

    Please help me ,

    Thanks i advance

    ReplyDelete
  8. How do I add an icon to the new custom element (i.e. I'd like to put the Dynamics CRM icon next to a new element that links to my internal CRM system giving my SharePoint landing page into more of a portal to all the resources of my network)?

    ReplyDelete
  9. @Benjamin, you can add image to the custom action by adding 'ImageUrl="/_layouts/myimages/img.png'. You can find full details schema for custom action at: http://msdn.microsoft.com/en-us/library/ms460194.aspx

    ReplyDelete

Note: Only a member of this blog may post a comment.