0
votes

We have developed an internal portal with multiple subsites using sharepoint office 365. We created our own page layouts/masterpage for the sites and most of the things like menu's, page body and page logos are customized(unique for all sites/subsites).

Each page has a header logo and a url assigned to that logo(logo describes site or subsite name). We have written a javascript file to load these logo and url and calling on the masterpage. Now the problem is these logo and link should load based on Global navigation

Example: If the site is using the same navigation items as the parent site?

  • Yes - pull logo and link from site above
  • No - pull logo and link according to site name

if i get the GlobalNavigation setting value then i can do this in javscript file. Is there a way to get this GlobalNavigation setting value in javascipt file? I googled on this but didn't get enough information.

Thanks in advance,

Amarnath

--------UPDATED------- I am using the below code but getting error "sp.runtime.js:2 Uncaught Error: The property or field 'Source' has not been initialized. It has not been requested or the request has not been executed. It may need to be explicitly requested"

used code

1

1 Answers

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

        //Navigation Provider Settings for Current Web.
        var webNavSettings = new SP.Publishing.Navigation.WebNavigationSettings(ctx, web);

        //Global Navigation (Top Navigation Bar)
        var navigation = webNavSettings.get_globalNavigation();

        navigation.set_source(1);
        webNavSettings.update();
        ctx.executeQueryAsync(onSuccess, onFailure);