2

We have a client requirement in which we have to display Microsoft NAV pages in SharePoint web parts . I know we can do this by using "SharePoint Add-ins". Can we do it by using SharePoint Web Part ?

  • Hello @Rohit Kharade , Your feedback is very important 1. Are the below answers didn't helped you? 2. Do you need any further clarifications? if yes, please comment to the provided answers with your clarifications to can help you or edit your question with these clarifications, else please upvote and mark the correct answer that helped you as accepted to close this question. Thanks! – Mohamed El-Qassas MVP Sep 14 '18 at 17:32
2

Yes, you can get the web navigation in SharePoint visual web part and show it as you prefer

To get the Web Navigation via SSOM

// Web Navigation
   using (var site = new SPSite("http://somesite"))
    {
     using (var web= site.OpenWeb())
       {
           // Web Navigation
            var navigation = web.Navigation; 
             foreach (NavigationNode node in topNavigationColl)
                 {
                    // add your code
                 }
       }
     }    

To get the Web Navigation via CSOM

ClientContext clientContext = new ClientContext(siteURL);

 Web web = clientContext.Web;
// Get the navigation nodes from the top navigation bar

NavigationNodeCollection topNavigationColl = web.Navigation.TopNavigationBar;
clientContext.Load(topNavigationColl); 
clientContext.ExecuteQuery();

// loop to get each node
  foreach (NavigationNode node in topNavigationColl)
      {
         textbox.Text += node.Title;
         // you can also bind it to gridview or dropdownloist
      }

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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