locked
Inheriting site collection top site master page to all subsites in SharePoint2013 Foundation? RRS feed

  • Question

  • Hi,

    I have SharePoint Foundation 2013 and created a site collection.

    To top level site of site collection I have created master page.If I creates any sub site the custom top level site master page does not apply to sub site in SharePoint Foundation 2013.

    So how do I apply top level sites master page to all it's sub sites?

     

    Thanks in advance.

    Chaitanya
    Monday, June 3, 2013 12:44 PM

Answers

  • The url of the default master page is stored as a property of the SPWeb object called MasterUrl.  To use the same master page in all sub sites you need to change the URL address stored in that property on each sub site.  Since it is stored separately there is no way to make the change once and have it apply to all sub sites.  The SharePoint Server Publishing features have implemented that functionality, but that's not available in Foundation.  You either need to change the master page of each sub site after its created or write custom code to make the change for you.  For example, you could write a powerShell routine that would recursively walk the site collection to change all the Sub site MasterUrl properties.

    Paul Stork SharePoint Server MVP
    Principal Architect: Blue Chip Consulting Group
    Blog: http://dontpapanic.com/blog
    Twitter: Follow @pstork
    Please remember to mark your question as "answered" if this solves your problem.


    Monday, June 3, 2013 12:58 PM
  • You could create whats called a stapler.

    This blog describes it fairly well ( its for sharepoint 2010 ) but applies to 2013 as well.
    The blog post describes how to stable a custom masterpage to your mysite - but it can apply to any site definition you have - so when you get to the point where he writes about - associating feature with site definition - you need to apply it for your needs instead of mysite definitions.

    http://samuelnmensah.com/feature-stapling-in-sharepoint-2010/

    This is not ment for office 365 hosting - but instead local server installation.

    Regards

    Ole


    • Edited by Lytjohan Tuesday, June 4, 2013 12:33 PM
    • Marked as answer by star.wars Friday, June 14, 2013 3:09 AM
    Tuesday, June 4, 2013 12:31 PM

All replies

  • The url of the default master page is stored as a property of the SPWeb object called MasterUrl.  To use the same master page in all sub sites you need to change the URL address stored in that property on each sub site.  Since it is stored separately there is no way to make the change once and have it apply to all sub sites.  The SharePoint Server Publishing features have implemented that functionality, but that's not available in Foundation.  You either need to change the master page of each sub site after its created or write custom code to make the change for you.  For example, you could write a powerShell routine that would recursively walk the site collection to change all the Sub site MasterUrl properties.

    Paul Stork SharePoint Server MVP
    Principal Architect: Blue Chip Consulting Group
    Blog: http://dontpapanic.com/blog
    Twitter: Follow @pstork
    Please remember to mark your question as "answered" if this solves your problem.


    Monday, June 3, 2013 12:58 PM
  • You could create whats called a stapler.

    This blog describes it fairly well ( its for sharepoint 2010 ) but applies to 2013 as well.
    The blog post describes how to stable a custom masterpage to your mysite - but it can apply to any site definition you have - so when you get to the point where he writes about - associating feature with site definition - you need to apply it for your needs instead of mysite definitions.

    http://samuelnmensah.com/feature-stapling-in-sharepoint-2010/

    This is not ment for office 365 hosting - but instead local server installation.

    Regards

    Ole


    • Edited by Lytjohan Tuesday, June 4, 2013 12:33 PM
    • Marked as answer by star.wars Friday, June 14, 2013 3:09 AM
    Tuesday, June 4, 2013 12:31 PM