Saturday, October 18, 2008

SharePoint Custom Actions

I came across requirement of customizing out of box SharePoint pages (like create.aspx, spcf.aspx, qstnew.aspx) to fulfill client need to add functionality or custom code in those pages.

Generally we are making copy of those pages for making changes and add custom link on page from where it’s getting called.


If you are required to override the Web Part Page/Survey Creation Page (spcf.aspx/new.aspx) then you have to add link under particular Group in Create.aspx page. This you can achieve without writing any code in create.aspx by creating Feature using Custom Actions.

SharePoint provides so many defaults Custom Actions which we can use as per our creativity.

Code example: To add custom link in Site Actions Menu which takes user to custCreate.aspx page.

Id = "RepLetterCustCreatePage"
Title = "Custom Create"
Description = "Add a new library, list or web page to this website using custom Create Page."
GroupId = "SiteActions"
Location = "Microsoft.SharePoint.StandardMenu">

<UrlAction Url="~site/_layouts/custcreate.aspx"/>


Example :

I also added custom link into SharePoint Central Admin Site into Operation TAB, on clicking of new added link, I am opening my ASPX page from Central Admin site.

Element file look like:

<Elements xmlns="">

Title="Custom Security"

Title="Termination Job">

<UrlAction Url="/_admin/TerminationJob.aspx"/>



One more thing, I remember that after developing feature, I was not able to see custom link into Central Admin site, I came to know that in feature file, where we are defining element manifest file, I use wrong tag for giving XML file location, we have to use


<ElementManifest Location="elementManifest.xml" />


I was using

<ElementFile Location="elementManifest.xml" />

Useful reference link for Custom Actions:

No comments:

Post a Comment