SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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);  


looking for some reasons and work arounds. Thanks!

share|improve this question
up vote 1 down vote accepted

The syntax is fine, I run the exact same code and it works without a problem.

Some things to look at:

  • Does your account have the right level of access? I know, probably silly question, but just checking
  • What does the ULS log say when you're running this command?
  • Try wrapping in an SPSecurity.RunWithElevatedPrivileges({}) statement
  • Try some more simple cases (get the web then update it immediately without adding anything to the navigation bar to verify navigation is part of the problem)
share|improve this answer
Thanks for checking this for me. The trick for me was to run my powershell window using an account capable of adding top nav links – ChiliYago Jan 11 '11 at 0:31

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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