I have following code
var subWeb = newWeb.Webs.Add(subsite.Url, subsite.Title, subsite.Title, 1033, PublishTemplate, false, false); subWeb.AllowUnsafeUpdates = true; subWeb.Update(); PublishingWeb publiSubWeb = PublishingWeb.GetPublishingWeb(subWeb); publiSubWeb.Navigation.InheritGlobal = true; publiSubWeb.Navigation.GlobalIncludeSubSites = true; publiSubWeb.Navigation.GlobalIncludePages = true; // <-- Does not work publiSubWeb.Navigation.CurrentIncludePages = true; // <-- Does not work publiSubWeb.Navigation.CurrentIncludeSubSites = true; publiSubWeb.Navigation.SortAscending = false; publiSubWeb.Update(); subWeb.Update();
But it seems that the navigation properties "GlobalIncludePages" en "CurrentIncludePages" are not working. When I browse to the Navigation site (Site Settings) the "Show Pages" in the Current & Global Navigation is still unchecked... Also the property "ShowSiblings" (in other code by me) does not work.
I already put AllowUnsafeUpdates and some extra web updates in my code; but also this does not help.
I am using a sandboxed solution. When I execute the same code in a console application it works. Strange. Is this really a limit of the sandbox???