Online Training On SharePoint
                      

Monday 15 September 2008

Changing Master Page for Document Library in SharePoint

We came across a issue with applying master page to the Document Libraries. We have applied a master page to the sites and any web pages that is created in the sites and sub sites shows this master page. However when we click on a document library the default SharePoint Master Page was coming.

On further analysis what we found that there are three master pages used in SharePoint.
1. Master Page for Site Pages. This Master page is used in home page (default.aspx), WebPages etc..
2. Master Page for System Pages like Document Library Item Form pages (All Items.aspx, NewForm.aspx, EditForm.aspx, etc)
3. Master Page for Application Pages under "Layouts" folder. The application pages uses the "application.master" page.

So in the scenarion, we had set the Site pages to use the master page but not the system pages. When we click on document library we will be landing on the Allitems.aspx which is the View Page (System Page) for the "All Items" View. The System Pages are still using the default master page with the default theme and thats the reason the default theme is rendered for the document library.

To Overcome this issue, we need to use the "MasterURL" and the "CustomMasterURL" property to set the master page of "System Pages" and "Site Pages" respectively. In our custom site definition "Onet.xml" find the "Configuration" we used for your template and add the above mentioned properties to it. Set the master page URL (Master Page gallery path) as the value for this both the properties so that our master page and theme in it will be applied to both Site Pages and the System Pages. Following Code snippet can be used for this:

5 comments:

Anonymous said...

Hi,

I'm dealing with the same issue and looking for the solution. But I cannot see any code snipet you are referencing. Could you fix your post to show these code lines as well?

It would be very appriciated.

By the way it would be also great if you tell us how to exactly configure the configuration element. Should I create a new one next to the "Default" or something like that?

Thank you anyway.

Tom

Unknown said...

Hi
I have updated the code snippet. hope this helps you.
Thanks
Manish

Jasper said...

Hello,

I would like to do exactly what your doing, but only for a single site in my collection. I've got the master pages running well for normal pages, but all admin and document-type views are still using the old one. If I'm not mistaken altering the ONET.XML file will change this configuration for all site collections, right? If so, is there a way of doing this without altering every site?

Anonymous said...

hi,

i have to make a page, chromed view, which is reference to customized masterpage.

i need to make this chromed view available in each document library.

so by default when i create document library i have allitems.aspx, Upload.aspx etc. Now i want add other default page which is refer to customized master page every time i create new document library.

can you help me? thx

Anonymous said...

Hello,
Very interesting post but is there a solution for nr 3 in your list?
I am trying to customize the _layouts/Upload.aspx page in order to have a custom master page. I did it by making a copy of the original page and changed the master page in the copy. The problem that I am still facing is that when I click the OK button I get an error: "The security validation for this page is invalid"...
So any suggestion would be very appreciated.
Thanks in advance!

Claudiu

Related Posts with Thumbnails