Take the 2-minute tour ×
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
add comment

1 Answer 1

up vote 5 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;
    web.Update();

    ctx.Load( web );
    ctx.ExecuteQuery();
}
share|improve this answer
add comment

Your Answer

 
discard

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.