I can retrieve a title $list.Title, but a title is not the same as url.

In C# I can get list.DefaultViewUrl, which doesn't seem to be an option in Powershell.

I found this solution with $List.RootFolder.Url but it returns empty, so I assume it's not available for SharePoint Online.

Anything else I can try?

1 Answer 1


How to retrieve List Url in SharePoint Online using PowerShell


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)

$listUrl = $list.RootFolder.ServerRelativeUrl


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


$Url = $WebUrl + "/_api/web/lists/getByTitle('" + $listTitle +  "')/RootFolder?$select=ServerRelativeUrl"  
$data = Invoke-RestSPO $Url Get $UserName $Password
$listUrl = $data.ServerRelativeUrl
  • :) Glad this helped you! Commented Dec 13, 2014 at 20:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.