Pages

Search This Blog

Thursday, December 30, 2010

Customize Default Sharepoint 2010 Application Pages

Have u ever wondered if its possible to customise any of the sharepoint default application pages that reside in "_Layouts" hive as per your business requirement. I will write some detailed steps to accomplish this.

Let us consider a business requirement which says that user should not be able to checkin the major version of a document while checking in a document.

Now since, when user checks in a document, sharepoint opens up "checkin.aspx" page, we will copy the page and customize it since we cannot customise the original page (that will effect whole of the farm). Rename the copied page to "customCheckin.aspx".

Open the custom page and find the tag " and replace it to ""
In the similar way find the tag "{asp:placeholder id="CheckinOverWriteOption" runat="server"}" and replace it with "{asp:placeholder id="CheckinOverWriteOption" runat="server" visible="False"}"

Note: You can customize the page as per your requirement.

Now the issue it to show this page instead of default checkin page whenever user performs checkin, so the easiest solution would be to add a "mapping Url" entry in Web.Config of your application. To do this, open your web.config file and add below lines under "{system.web}" tag.

{urlMappings enabled="true"}
{add url="~/_layouts/checkin.aspx" mappedUrl="~/_layouts/customCheckin.aspx" /}
{/urlMappings}



Now open your site and try to checkin a document, and you will see your checkin page instead of default. (the url will still remains the same in browser as _/layouts/checkin.aspx" but the page will be yours).

3 comments:

  1. Hi Vishal,

    This is good information, do you know how I can included this changes on a SharePoint wsp deployment package?
    Thanks
    Mayoo Satha
    msatha@gmail.com

    ReplyDelete
  2. Thank you so much Vishal for this wonderful article. I have question though. I tried this but found out The redirection of custom page is working only on root site and not sub-sites. So, I put two mapping urls {add url="~/sub-site1/_layouts/checkin.aspx" mappedUrl="~/sub-site1/_layouts/Customcheckin.aspx" /}. But I have 100's of sites and sub-sites where i want to have custom checkin.aspx and i think it is not feasible to put 100's of mapping urls in web.config. Could you please suggest anything?


    Thanks,
    Khushi

    ReplyDelete
  3. Khushi,

    You can try these combinations :

    url="~/_layouts/checkin.aspx"
    or
    url="~/*/_layouts/checkin.aspx"

    ~nitin

    ReplyDelete