In a SharePoint (MOSS 2007) environment how can I list all the Master Pages (templates) that are used in a site collection? I need to add some code to the header of every master page, but there are a lot of subsites and I don't want to have to go to each subsite and check which master page it is using.

1 Answer 1


The master pages available in the Master pages and page layouts gallery at the root site of the site collection are available to all its sub sites. So you need update all the matser pages in there with the required headers.

Once this is done, changes would automatically reflect on all sub sites in that site collection using those master pages.

note: the master pages must be checked-in are approved after the updates

  • There are a lot of legacy Master pages there that are not used, I need to be able to tell which are actually in use.
    – DrStalker
    Oct 1, 2010 at 6:33
  • 1
    Well there is no straight forward route to find the active master pages from top to bottom in a site collection. You would need to write a console application that can iterate recursively across the site collection and print the values of SPWeb.MasterUrl and SPWeb.CustomMasterUrl property.
    – Vivek
    Oct 1, 2010 at 7:11
  • The comment is the accepted answer, not the accepted answer. If that makes sense. :-)
    – DrStalker
    Oct 5, 2010 at 22:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.