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:
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.
You can get a set of groupid and location values for SharePoint from this MSDN link.
<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.
You can get a set of groupid and location values for SharePoint from this MSDN link.
No comments:
Post a Comment