How to retrieve List Url in SharePoint Online using PowerShell
CSOM
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 $UserName -Password $Password
$list = $context.Web.Lists.GetByTitle($listTitle)
$context.Load($list.RootFolder)
$context.ExecuteQuery()
$listUrl = $list.RootFolder.ServerRelativeUrl
REST
SharePoint RESTful web services could be consumed in PowerShell, follow an article Consuming the SharePoint 2013 REST API from PowerShell for a more details.
Endpoint: /_api/web/lists/getByTitle('<list title>')/RootFolder?$select=ServerRelativeUrl
Example:
$Url = $WebUrl + "/_api/web/lists/getByTitle('" + $listTitle + "')/RootFolder?$select=ServerRelativeUrl"
$data = Invoke-RestSPO $Url Get $UserName $Password
$listUrl = $data.ServerRelativeUrl