Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Begin the process
- $loadInfo1 = [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint.Client")
- $loadInfo2 = [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint.Client.Runtime")
- $loadInfo3 = [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint.Client.UserProfiles")
- # Change to match your tenant information
- $webUrl = "<your-site-url>"
- $username = "<your-admin-login>"
- $password = "<your-admin-password>"
- $securePass = ConvertTo-SecureString $password -AsPlainText -Force
- $ctx = New-Object Microsoft.SharePoint.Client.ClientContext($webUrl)
- $ctx.Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($username, $securePass)
- # Get the collection of navigation nodes from the quick launch bar
- $web = $ctx.Web
- $quickLaunch = $web.Navigation.QuickLaunch
- # Add a new navigation node
- $navNode = New-Object Microsoft.SharePoint.Client.NavigationNodeCreationInformation
- $navNode.AsLastNode = $true
- $navNode.Title = "Site Contents"
- $navNode.Url = $web.Url + "_layouts/15/viewlsts.aspx"
- $navNode.IsExternal = $false
- $ctx.Load($quickLaunchColl.Add($navNode))
- $ctx.ExecuteQuery()
- Write-Host "Done!"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement