I want to access the SP2013 Site Settings-->Master Page/Navigation settings etc using CSOM (client side object model) using JavaScript or REST service or Webservice which I can call from Javascript.

To be more specific:

I want to access and change the Site Setting--> Navigation (under look and Feel)--> Global and Current Navigation to "Structural Navigation" instead of "Managed Navigation". I want to achieve this using CSOM (Javascript / REST/WebSErvice). I dont want to use server side or managed object model.

Can I get the pointer if such API/objects available for SP 2013?

Thanks nks

2 Answers 2


I had received similar 'File Not Found' error while trying to set the master page. Try to set your custom master page as:

var ctx = new SP.ClientContext.get_current();
var web = ctx.get_web();

ctx.load(web, 'ServerRelativeUrl');

function() {
    window.console && console.log('Master page successfully set to: ' + web.get_customMasterUrl());
function (sender, args) { alert("Error" + args.get_message());

Note the site relative path: "/sites/site_collection" which is needed if your site is not at the root level.


Haven't actually tried, but using ClientContext you should be able to retrieve current Web and set its CustomMasterUrl (http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.client.web.custommasterurl.aspx) using something like

// Starting with ClientContext, the constructor requires a URL to the 
// server running SharePoint. 
ClientContext context = new ClientContext("http://SiteUrl"); 

// The SharePoint web at the URL.
Web web = context.Web; 

web.CustomMasterUrl = "<path_to_master>"; 

// Note that the web.Update() does not trigger a request to the server
// because the client library until ExecuteQuery() is called. 

// Execute the query to server.
  • Thanks Marius, but my requirement is to get and then set the Master Page which are available at that point of time. Would be great if you could give some more pointers!!! thanks nks
    – nks
    Mar 8, 2013 at 22:21
  • Sorry, but from your question it doesn't show as such. All master pages are in _catalogs/masterpage library. you only need to get all file with .master extension, e.g. adapt this example msdn.microsoft.com/en-us/library/… Mar 8, 2013 at 23:00
  • Thanks again Marius...using C# CSOM I can still find the master page. Do you have any idea if we can do it with JavaScript/Jquery OR WebService from API OR REST API?? Happy weekend!!!
    – nks
    Mar 9, 2013 at 0:46
  • Yes, you should be able to do the exact same operations Mar 9, 2013 at 9:33
  • I am able to change the Master Page but as soon as I refresh my Page after this change. I get File not found error on my pages of site. Do you have any idea if we are missing anything here? var web;var masterurl;var site; function sharePointReady() { context = new SP.ClientContext.get_current(); web = context.get_web(); context.load(web, 'ServerRelativeUrl'); web.set_customMasterUrl('/_catalogs/masterpage/seattle.master'); web.update(); context.executeQueryAsync(Function.createDelegate(this, this.onSuccess), Function.createDelegate(this, this.onFail)); }
    – nks
    Mar 12, 2013 at 0:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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