I am receiving the following error when attempting to add a Link to the Top Navigation Bar.
"Exception calling "AddAsLast" with "1" argument(s): "Access is denied"
Here is the code:
$web = Get-SPWeb $url.Url;
$newLink = New-Object Microsoft.SharePoint.Navigation.SPNavigationNode -ArgumentList @($web.Title, $web.Url);
$web.Navigation.TopNavigationBar.AddAsLast($newLink);
$web.Update();
looking for some reasons and work arounds. Thanks!