Set global navigation items through CSOM - C#

Copper Contributor

I am trying to delete all the top navigation items from a console application, and add headers/sub items to the top navigation. I am also trying to uncheck the options to show subsites and show pages.

I found few articles talking about this, they suggest doing something like this:

  using(var ctx = new ClientContext("url"))
            var web = ctx.Web;   
.AllProperties["__GlobalNavigationIncludeTypes"] = "1";
.ExecuteQuery(); }

This isn't working for me, I can't uncheck the show pages or show subsites option.

What I need to do is to clear the top navigation, then start adding links and headers. How do I achieve that from a console application?


1 Reply

Hi, I thing you need to set it to the number 1, not the string "1"


I use the same code and it works.