GET request
/_api/Web?$select=CustomMasterUrl,MasterUrl
function MastePageChange() {
var clientcontext;
var cweb;
var customMasterURL = '/_catalogs/masterpage/NewMasterPage.master';
clientcontext = new SP.ClientContext.get_current();
cweb = clientcontext.get_web();
cweb.set_customMasterUrl(masterPageUrl);
cweb.set_masterUrl(masterPageUrl);
cweb.update();
clientcontext.executeQueryAsync(function() {
alert("Master Page has been changed successfully \n" + customMasterURL);
}, function(sender, args) {
alert("Error: " + args.get_message());
});
}
MastePageChange();
/_api/Web?$select=CustomMasterUrl,MasterUrl
function MastePageChange() {
var clientcontext;
var cweb;
var customMasterURL = '/_catalogs/masterpage/NewMasterPage.master';
clientcontext = new SP.ClientContext.get_current();
cweb = clientcontext.get_web();
cweb.set_customMasterUrl(masterPageUrl);
cweb.set_masterUrl(masterPageUrl);
cweb.update();
clientcontext.executeQueryAsync(function() {
alert("Master Page has been changed successfully \n" + customMasterURL);
}, function(sender, args) {
alert("Error: " + args.get_message());
});
}
MastePageChange();