I'm trying to create links under 'Global Navigation' and checked "Show All pages" option in SharePoint Online. It is not creating links in Global navigation and it is not throwing any exception also. I have checked that in AreaNavigationSettings.aspx links are not added. We have created master page using design manager there i have used 'Top navigation' snippet.
Web web = context.Web; context.Load(web); NavigationNodeCollection topNavNodeColl = web.Navigation.TopNavigationBar; //Create a new node NavigationNodeCreationInformation newNavNode = new NavigationNodeCreationInformation(); newNavNode.Title = "sample title"; newNavNode.Url = "site url"; newNavNode.AsLastNode = false; // I have tried with 'true' also topNavNodeColl.Add(newNavNode); context.Load(topNavNodeColl); context.ExecuteQuery();