Sign up ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

Using CSOM and c#, I would like to change the master-page from Seattle to Oslo. Can anybody help me?

share|improve this question

2 Answers 2

up vote 7 down vote accepted

Use the MasterUrl and CustomMasterUrl properties of Web:

using (var ctx = new ClientContext( url ))
    var web = ctx.Web;
    var masterPageUrl = String.Format( "{0}/_catalogs/masterpage/oslo.master", ctx.Web.ServerRelativeUrl );

    web.MasterUrl = masterPageUrl;
    web.CustomMasterUrl = masterPageUrl;

    ctx.Load( web );
share|improve this answer
how can i reset all subsites to use same master page? – vignesh Oct 7 at 3:43
The master page will have to be uploaded to every site collection and published. Then go through each site collection with the code in my answer. – wjervis Oct 7 at 4:58… can you answer this question which is on the same line? – vignesh Oct 8 at 3:30

Changing Master page is very easy in SharePoint Using CSOM, we can give the Master Page URL in the web masterpage property, for reference u can check this link :

share|improve this answer
is there a way to enforce "reset all subsites to use same master page" using CSOM? – vignesh Oct 7 at 9:30

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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