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

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

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

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 : http://www.sharepointsol.com/2015/01/apply-master-page-using-csom.html

share|improve this answer

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.