This blogs will helps you to retrive all SubSites under Site Collections in SharePoint online using PowerShell Method.
Steps
Steps
- Open SharePoint Management Shell.
- Copy the below Code and paste it.
- Run the Code
- ##########################
- #Script : Below Script will retrieve List Url in SharePoint 2013 Online in Office 365 SharePoint Online
- #Author : Gowtham Rajamanickam
- #Date : 21-03-2017
- #Version:1.0
- #########################
- Function Get-SPOCredentials([string]$UserName,[string]$Password)
- {
- $SecurePassword = $Password | ConvertTo-SecureString -AsPlainText -Force
- return New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($UserName, $SecurePassword)
- }
- $context = New-Object Microsoft.SharePoint.Client.ClientContext($Url)
- $context.Credentials = Get-SPOCredentials -UserName "Enter Your 0365 user Name " -Password "Enter Your Password Here"
- $list = $context.Web.Lists.GetByTitle($listTitle)
- $context.Load($list.RootFolder)
- $context.ExecuteQuery()
- $listUrl = $list.RootFolder.ServerRelativeUrl
- Write-Host $listUrl
Conclusion
Was my Blog helpful?Was it missing content? If so, please let us know what's confusing or missing at the bottom of this page.
Thanks for reading my blogs.
Was my Blog helpful?Was it missing content? If so, please let us know what's confusing or missing at the bottom of this page.
Thanks for reading my blogs.

poonam singhPosted Apr 8, 2019, 4:39 PM
Do I need to have a admin rights on sharepoint site to run this script. I tired running it. It is connecting to the site, but erroring out.