Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #Add a new link
- $url = "http://sharepoint.domain.com"
- $spWeb = Get-SPWeb -Identity "$($Url)" -ErrorAction SilentlyContinue
- # Add link
- # The format is DisplayName, link, is external (true/false)
- $node = New-Object Microsoft.SharePoint.Navigation.SPNavigationNode("Test Link", "javascript:alert('test alert')", $true)
- $spWeb.Navigation.QuickLaunch.AddAsFirst($node)
- $spWeb.Dispose()
- #Update existing link
- $spWeb = Get-SPWeb -Identity "$($Url)" -ErrorAction SilentlyContinue
- # Update link
- # Select the menu if necessary
- $selLink = $spWeb.Navigation.QuickLaunch | ? {$_.Title -eq "LinkName"}
- $selLink.Url = "javascript:alert('test')"
- $selLink.Update()
- $spWeb.Dispose()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement