SharePoint2010-Ribbon-Custom-Action

In this Post we learn. How to create custom action in various locations.

We learn.

1.       Insert simple custom action button in Standard Menu.
2.       Insert simple custom action in List Edit.
a.       Using Unique RegistrationId ie List URL ie {$ListId:Lists/contacts;}" (only work for sandbox solutions)
b.      Using Unique RegistrationId ie List GUID.

Steps.

1.       Open visual studio 2010 under SharePoint2010 create empty SharePoint project.
2.       Add empty element from file menu.
3.       In element.xml add xml.


Solution 1 : Insert simple custom action button in Standard Menu.


Element.xml

<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
  <CustomAction
     Title="Test Links"
     Description="this is going to be a tool tip"
     Location="Microsoft.SharePoint.StandardMenu"
     GroupId="SiteActions"
     Rights="ManageWeb">
    <UrlAction Url="javascript:alert('hello world site url is {SiteUrl}');"></UrlAction>
  </CustomAction>
</Elements>

Output of the file

Solution 2 : Insert simple custom action in List Edit.

a.       Using Unique RegistrationId ie List URL ie {$ListId:Lists/contacts;}" (only work for sandbox solutions)

<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
  <CustomAction
     Title="Test Links"
     Description="this is going to be a tool tip"
     Location="Microsoft.SharePoint.ListEdit"
     GroupId="Communications"
     Rights="ManageWeb"
     RegistrationType="List"
     RegistrationId="{$ListId:Lists/contacts;}">
    <UrlAction Url="javascript:alert('hello world site url is {SiteUrl}');"></UrlAction>
  </CustomAction>
</Elements>

Output



Solution 2 : Insert simple custom action in List Edit.

b.      Using Unique RegistrationId ie List GUID.

Element.xml File

<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
  <CustomAction
     Title="Test Links"
     Description="this is going to be a tool tip"
     Location="Microsoft.SharePoint.ListEdit"
     GroupId="GeneralSettings"
     Rights="ManageWeb"
     RegistrationType="List"
     RegistrationId="{4222401E-1B28-4F0F-9ADC-98BCB9AF6426}">
    <UrlAction Url="javascript:alert('hello world site url is {SiteUrl}');"></UrlAction>
  </CustomAction>
</Elements>

Output


Comments

Post a Comment

Popular posts from this blog

SharePoint RPC Protocols Examples Using OWSSVR.DLL

Send Email using SharePoint Rest API

Query suggestions in SP 2013 Using Rest API (/_api/search/suggest)