Forum Discussion
TammyLee Lee
Nov 29, 2016Copper Contributor
Set global navigation items through CSOM - C#
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;
web.AllProperties["__GlobalNavigationIncludeTypes"] = "1";
ctx.Load(web);
ctx.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?
Thanks.
- Russell GoveIron Contributor
Hi, I thing you need to set it to the number 1, not the string "1"
I use the same code and it works.