I had been recently working with SharePoint and PowerApps a lot and today in my blog I am going to pen down a very interesting stuff I came across.
I had a site collection which had multiple lists. And I needed the URL for each SharePoint list inside the site collection.
While it may sound really easy to do it using SharePoint UI, it is not. Finding all the SP lists inside a site collection can be pretty challenging from UI. And that’s when I went the PowerShell route.
Let’s do this together. Open a PowerShell command prompt and install the PnP.PowerShell module if not already installed.
The next step is to set up the connection with the SharePoint site. For that use the following code.
$site_url = "<site_collection_url>"
$site = Connect-PnPOnline -Url $site_url -UseWebLogin
It will connect to your SharePoint site collection using an interactive UI. Now to get the list, you just need to use the following command.
Get-PnPList
And below is the result I get.
Sometimes it’s the URL which you want. If your URL is too long, it may not show the full URL. For that you can use the following command.
$lists = Get-PnPList
Foreach($item in $lists)
{
echo $item.defaultviewurl
}
I hope this helped! You will also like the below posts.
Debajit Dutta
Business Solutions MVP
Discover more from Debajit's Power Apps & Dynamics 365 Blog
Subscribe to get the latest posts sent to your email.