Title: Using Custom Actions in SharePoint 2010
Details: Using Custom Actions in SharePoint 2010 is not different as you create them in either WSS3.0 / MOSS 2007. In this post I will run through the sample of creating your own Custom Group and then a Custom Action link under it. Now before we proceed, I created a very nice pic of mine and sized it to 48x48 and copied it to the 14 hive / Template / Images folder ( named as SiteSettings_SriniSistla_48x48.jpg in this case ). Alright, now lets proceed for few steps.
Step # 1 Create a folder ( MyCustomActions in my example ) with a proper name of your choice
Step # 2 Add a new file to the folder and name it as Feature.xml
Step # 3 Add the content as shown in below code and customize it to your needs. Well, notice that this feature is Scoped to Site and you can create a feature for any scope based on where you want to have the Custom Action.
Step # 5 Add the content as shown in below code and customize it to your needs.
Step # 7 Once you have everything in place, copy this folder to 14 hive > Template > Features.
Step # 8 I am happy for now in still using STSADM commands and I will go ahead and use the Install Feature Command here.
Step # 10 Once you activate the feature, you will find the Custom Actions group and the Custom Actions Link on your site actions > site settings page as shown below.
So far so good. Notice the GroupId="SriniSistla" in my example. If you want to add to an already existing out of the box groups use below GroupId's.
First, to Add your Custom Actions under Site Actions > Site Settings Page set the Location="Microsoft.SharePoint.SiteSettings" and
GroupID="Customization" to add under 'Look and Feel Section'
GroupID="Galleries" to add under Galleries'
GroupID="SiteAdministration" to add under 'Site Administration'
GroupID="SiteCollectionAdmin" to add under 'Site Collection Administration'
GroupID="UsersAndPermissions" to add under 'Users and Permissions'
for entire Custom Actions list, refer to the msdn site here.
have fun.
Details: Using Custom Actions in SharePoint 2010 is not different as you create them in either WSS3.0 / MOSS 2007. In this post I will run through the sample of creating your own Custom Group and then a Custom Action link under it. Now before we proceed, I created a very nice pic of mine and sized it to 48x48 and copied it to the 14 hive / Template / Images folder ( named as SiteSettings_SriniSistla_48x48.jpg in this case ). Alright, now lets proceed for few steps.
Step # 1 Create a folder ( MyCustomActions in my example ) with a proper name of your choice
Step # 2 Add a new file to the folder and name it as Feature.xml
Step # 3 Add the content as shown in below code and customize it to your needs. Well, notice that this feature is Scoped to Site and you can create a feature for any scope based on where you want to have the Custom Action.
<?xml version="1.0" encoding="utf-8"?> <Feature xmlns="http://schemas.microsoft.com/sharepoint/" ActivateOnDefault="FALSE" AlwaysForceInstall="FALSE" AutoActivateInCentralAdmin="FALSE" Description="Will Create a Section and Link to my Blog" Hidden="FALSE" Id="90C924A7-32F7-4C19-BD4C-AF49EF0563A9" Scope="Site" Title="My Custom Actions"> <ElementManifests> <ElementManifest Location="MyCustomActions.xml" /> </ElementManifests> </Feature>Step # 4 Create another file in the same folder ( myCustomActions.xml in my example ) and name it as Elements.xml or of your own choice
Step # 5 Add the content as shown in below code and customize it to your needs.
<Elements xmlns="http://schemas.microsoft.com/sharepoint/"> <CustomActionGroup Description="Srini Sistla Exclusive Custom Group" Id="SriniSistla" Url="/_layouts/images/SiteSettings_SriniSistla_48x48.jpg" Location="Microsoft.SharePoint.SiteSettings" Sequence="111" Title="Srini Sistla Blog Details"> </CustomActionGroup> <CustomAction GroupId="SriniSistla" Id="UserInterfaceCustomActions.SiteSettings" Location="Microsoft.SharePoint.SiteSettings" Sequence="106" Title="Blog Link"> <UrlAction Url="http://codename-srini.blogspot.com" /> </CustomAction> </Elements>Step # 6 Now, notice that I have a CustomActionGroup created first ( with Id = SriniSistla ) that I will use it in my CustomAction Section. You can create of your own choice in this case.
Step # 7 Once you have everything in place, copy this folder to 14 hive > Template > Features.
Step # 8 I am happy for now in still using STSADM commands and I will go ahead and use the Install Feature Command here.
stsadm -o installfeature -filename MyCustomFeature\Feature.xmlStep # 9 You can as well activate the feature using Stsadm itself, however you can as well go and activate your feature from the Site collection features link under Site Actions > Site Settings > Site Collection Administration as shown below.
Step # 10 Once you activate the feature, you will find the Custom Actions group and the Custom Actions Link on your site actions > site settings page as shown below.
So far so good. Notice the GroupId="SriniSistla" in my example. If you want to add to an already existing out of the box groups use below GroupId's.
First, to Add your Custom Actions under Site Actions > Site Settings Page set the Location="Microsoft.SharePoint.SiteSettings" and
GroupID="Customization" to add under 'Look and Feel Section'
GroupID="Galleries" to add under Galleries'
GroupID="SiteAdministration" to add under 'Site Administration'
GroupID="SiteCollectionAdmin" to add under 'Site Collection Administration'
GroupID="UsersAndPermissions" to add under 'Users and Permissions'
for entire Custom Actions list, refer to the msdn site here.
have fun.
Comments
Another sample to add a custom action to a ribbon bar you can find below. The sample adds a "Export to PDF" button to export SharePoint list data into a PDF document using a templating system:
http://www.parago.de/2011/04/how-to-export-sharepoint-task-list-data-to-pdf-using-a-templating-system/