Quantcast
Channel: SharePoint 2013 - Development and Programming forum
Viewing all articles
Browse latest Browse all 25064

Using PowerShell to Add Links to Navigation

$
0
0

So, here's my issue.

We have one site collection for our portal. This site collection has a website for each business unit. The url structure is:

  • http://portal.contoso.com
  • http://portal.contoso.com/Engineering

This site collection is design to be public to all of our employees. A site collection as been created for each business unit to be only viewed by those specific business users. The site collection url is:

  • http://portal.contoso.com/private/Engineering

I am trying to add a link to the quick launch on both the http://portal.contoso.com/Engineering and http://portal.contoso.com/private/Engineering sites (specifically via PowerShell). Below is my script:

$engWeb = Get-SPWeb http://portal.contoso.com/private/Engineering
$web = Get-SPWeb http://portal.contoso.com/Engineering
$node = New-Object Microsoft.SharePoint.Navigation.SPNavigationNode("Team Site", $engWeb.Url, $false)
$web.Navigation.QuickLaunch.AddAsFirst($node)

The error I get is as follows:

"Cannot open "/private/Engineering": no such file or folder."
If I do the EXACT same thing through the GUI, it works great! Any help would be appreciated.

Viewing all articles
Browse latest Browse all 25064

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>