Advertisement
Guest User

Untitled

a guest
Apr 6th, 2017
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.16 KB | None | 0 0
  1. # Begin the process
  2. $loadInfo1 = [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint.Client")
  3. $loadInfo2 = [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint.Client.Runtime")
  4. $loadInfo3 = [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint.Client.UserProfiles")
  5.  
  6. # Change to match your tenant information
  7. $webUrl = "<your-site-url>"
  8. $username = "<your-admin-login>"
  9. $password = "<your-admin-password>"
  10.  
  11. $securePass = ConvertTo-SecureString $password -AsPlainText -Force
  12.  
  13. $ctx = New-Object Microsoft.SharePoint.Client.ClientContext($webUrl)
  14. $ctx.Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($username, $securePass)
  15.  
  16. # Get the collection of navigation nodes from the quick launch bar
  17. $web = $ctx.Web
  18. $quickLaunch = $web.Navigation.QuickLaunch
  19.  
  20. # Add a new navigation node
  21. $navNode = New-Object Microsoft.SharePoint.Client.NavigationNodeCreationInformation
  22. $navNode.AsLastNode = $true
  23. $navNode.Title = "Site Contents"
  24. $navNode.Url = $web.Url + "_layouts/15/viewlsts.aspx"
  25. $navNode.IsExternal = $false
  26.  
  27. $ctx.Load($quickLaunchColl.Add($navNode))
  28. $ctx.ExecuteQuery()
  29.  
  30. Write-Host "Done!"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement