Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6165909
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T22:14:52+00:00 2026-05-23T22:14:52+00:00

Let me expose my question : I have a root site, with a masterpage,

  • 0

Let me expose my question :
I have a root site, with a masterpage, and many subsites. Some are using the root site masterpage (by inheriting) and some are not using the root site masterpage.

When I update the root site MP with a feature event receiver like that :

SPWeb w = ((SPSite)properties.Feature.Parent).OpenWeb();
Uri masterUri = new Uri(w.Url + "/_catalogs/masterpage/AdventureWorks.master");
//MasterPage used by publishing pages
w.CustomMasterUrl = masterUri.AbsolutePath;
w.AllowUnsafeUpdates = true;
w.Update();

… the master page is updated for the root site but NOT for the subsites wich inherit from the root site master page ! And when i go to Site Master Page Settings Page for a subsite, the “Inherit site master page from parent of this site” radio button is well checked.

When i apply the new MasterPage from the “Site Master Page Settings” Page I doesn’t meet this issue.

For information : My root site in a publidhing site and “SharePoint Server Publishing Infrastructure” and “SharePoint Server Publishing” features are running.

Do I miss something ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T22:14:53+00:00Added an answer on May 23, 2026 at 10:14 pm

    Still no responses after one month :/ So I guess that there is no mechanism to update all masterpages for subsites.
    So I have update the feature activated event receiver like this :

    using (SPWeb w = ((SPSite)properties.Feature.Parent).OpenWeb())
            {
                Uri masterUri = new Uri(w.Url + "/_catalogs/masterpage/AdventureWorks.master");
                w.CustomMasterUrl = masterUri.AbsolutePath;
                w.AllowUnsafeUpdates = true;
                w.Update();
    
                foreach (SPWeb ww in w.Site.AllWebs)
                {
                    if (!ww.IsRootWeb)
                    {
                        Hashtable hash = ww.AllProperties;
                        if (string.Compare(hash["__InheritsCustomMasterUrl"].ToString(), "True", true) == 0)
                        {
                            ww.CustomMasterUrl = masterUri.AbsolutePath;
                            ww.AllowUnsafeUpdates = true;
                            ww.Update();
                        }
                    }
                }
            }
    

    The goal is to test, foreach subweb, if it inherits masterPage (or not). If it does, we have to update the CustomMasterUrl property.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Let me give my question some context. I have a JavaScript widget. The widget
A dumb question: Let's say I have an object that i store in viewstate.
Sorry for the very noob question. Let's suppose I have an enum like so
Lots of frameworks let me expose an ejb as a webservice. But then 2
Scenario : You need to expose the same app on different screens - let's
Let's say I'm building a data access layer for an application. Typically I have
Let's say you have a class called Customer, which contains the following fields: UserName
Let me try to explain what I need. I have a server that is
Let's say we have a simple function defined in a pseudo language. List<Numbers> SortNumbers(List<Numbers>
Let's say I have a drive such as C:\ , and I want to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.