Live training: next batches coming soon. Join the waitlist:Waitlists open:Developer Training →Developer →Copilot Studio Training →Copilot Studio →

How to Get a SharePoint List GUID Using PowerShell (PnP and Get-SPWeb)

Power Automate actions, REST calls and SPFx web parts often want a list’s ID instead of its name. The quickest way to get a SharePoint list GUID is one PnP PowerShell line: connect to the site and read the Id property of Get-PnPList.

Connect-PnPOnline -Url "https://spguides.sharepoint.com/sites/SPGuides" -ClientId "<your-app-id>" -Interactive
(Get-PnPList -Identity "Service Requests").Id

It returns the GUID, for example 33175817-9f28-4ee2-b3a2-875b554b6bd0 for my Service Requests list.

In this tutorial, we’ll get a SharePoint list GUID with PowerShell for one list and for every list on a site, turn a GUID back into a list name, read a list’s created date and item count, and cover the browser trick and SharePoint Server.

Get a SharePoint list GUID with PnP PowerShell

You need PnP PowerShell in PowerShell 7 and your own Entra ID app’s client ID. If that’s new to you, follow installing PnP PowerShell for SharePoint Online first, then connect to SharePoint Online with PowerShell.

Here’s the script I ran against the SPGuides site. It prints the GUID three ways:

Get-PnPList Id property returning a SharePoint list GUID in PowerShell 7

The first line is a Guid object. .Guid gives the same value as plain text, and ToString("B") adds the curly braces some tools and XML files expect.

The SharePoint Online Management Shell has no list cmdlets, so Get-SPOSite can’t give you a list ID. Use PnP for anything inside a site.

How do I get the list ID of every list on a site?

Run Get-PnPList without -Identity and select Title and Id. I filtered out hidden system lists and kept custom lists (template 100), newest first:

Get-PnPList listing SharePoint list titles and GUIDs on the SPGuides site, newest first

Drop -First 15 to see all of them. For a full inventory with URLs and sizes, see getting all lists and libraries from a SharePoint Online site.

Libraries are lists too, so they have GUIDs. These variations return only libraries, or save everything to a CSV file:

# Document libraries only, with their GUIDs
Get-PnPList | Where-Object { $_.BaseType -eq "DocumentLibrary" -and -not $_.Hidden } |
    Select-Object Title, Id

# Every list and library, saved to a CSV file
Get-PnPList | Select-Object Title, Id, BaseType, ItemCount |
    Export-Csv -Path "C:\Scripts\SPGuides-list-ids.csv" -NoTypeInformation

Get the SharePoint list name from a GUID

Error messages, audit logs and flow run history often show only a GUID. Pass it to -Identity and you get the whole list back:

Get-PnPList finding the SharePoint list name, type and URL from a list GUID

The GUID belongs to Service Requests, a GenericList with 623 items. -Identity also accepts the list URL, so Lists/Service Requests returned the same ID. Once you have the list, reading its column details is the usual next step.

If nothing matches, Get-PnPList writes a “does not exist” error and returns nothing. In scripts, add -ThrowExceptionIfListNotFound so a wrong name stops the run instead of failing later:

try {
    $list = Get-PnPList -Identity "Lists/ServiceRequests" -ThrowExceptionIfListNotFound -ErrorAction Stop
}
catch {
    Write-Warning $_.Exception.Message
}

Get the list created date and item count

The same list object carries more than the ID. This script shows when the list was created, how many