Advertisement
Guest User

Untitled

a guest
Aug 21st, 2014
260
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. #Add a new link
  2. $url = "http://sharepoint.domain.com"
  3. $spWeb = Get-SPWeb -Identity "$($Url)" -ErrorAction SilentlyContinue
  4. # Add link
  5. # The format is DisplayName, link, is external (true/false)
  6. $node = New-Object Microsoft.SharePoint.Navigation.SPNavigationNode("Test Link", "javascript:alert('test alert')", $true)
  7. $spWeb.Navigation.QuickLaunch.AddAsFirst($node)
  8. $spWeb.Dispose()
  9.  
  10. #Update existing link
  11. $spWeb = Get-SPWeb -Identity "$($Url)" -ErrorAction SilentlyContinue
  12. # Update link
  13. # Select the menu if necessary
  14. $selLink = $spWeb.Navigation.QuickLaunch | ? {$_.Title -eq "LinkName"}
  15.  
  16. $selLink.Url = "javascript:alert('test')"
  17. $selLink.Update()
  18.  
  19. $spWeb.Dispose()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement