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.
Example:
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.
<CustomAction
Id = "RepLetterCustCreatePage"
Title = "Custom Create"
Sequence="2000"
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"/>
</CustomAction>
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="http://schemas.microsoft.com/sharepoint/">
<CustomActionGroup
Id="CustomSecurity"
Location="Microsoft.SharePoint.Administration.Operations"
Title="Custom Security"
Sequence="1000"
/>
<CustomAction
Id="TerminationJob"
GroupId="CustomSecurity"
Location="Microsoft.SharePoint.Administration.Operations"
Sequence="10"
Title="Termination Job">
<UrlAction Url="/_admin/TerminationJob.aspx"/>
</CustomAction>
</Elements>
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
<ElementManifests>
<ElementManifest Location="elementManifest.xml" />
</ElementManifests>
I was using
<ElementFile Location="elementManifest.xml" />
Useful reference link for Custom Actions:
http://msdn.microsoft.com/en-us/library/bb802730.aspx
http://msdn.microsoft.com/en-us/library/ms473643.aspx
No comments:
Post a Comment