Get-PnPList

Returns lists from SharePoint

Syntax

Get-PnPList
   [-Includes <String[]>]
              [-Identity <ListPipeBind>]
              [-ThrowExceptionIfListNotFound [<SwitchParameter>]]
              [-Web <WebPipeBind>]
              [-Connection <PnPConnection>]

Examples

------------------EXAMPLE 1------------------

Get-PnPList

Returns all lists in the current web

------------------EXAMPLE 2------------------

Get-PnPList -Identity 99a00f6e-fb81-4dc7-8eac-e09c6f9132fe

Returns a list with the given id

------------------EXAMPLE 3------------------

Get-PnPList -Identity Lists/Announcements

Returns a list with the given url

------------------EXAMPLE 4------------------

Get-PnPList | Where-Object {$_.RootFolder.ServerRelativeUrl -like "/lists/*"}

This examples shows how to do wildcard searches on the list URL. It returns all lists whose URL starts with "/lists/" This could also be used to search for strings inside of the URL.

Parameters

-Connection

Optional connection to be used by the cmdlet. Retrieve the value for this parameter by either specifying -ReturnConnection on Connect-PnPOnline or by executing Get-PnPConnection.

Type:PnPConnection
Position:Named
Accept pipeline input:False
Accept wildcard characters:False
-Identity

The ID, name or Url (Lists/MyList) of the list

Type:ListPipeBind
Position:0
Accept pipeline input:True
Accept wildcard characters:False
-Includes

Specify properties to include when retrieving objects from the server.

Type:String[]
Position:0
Accept pipeline input:False
Accept wildcard characters:False
-ThrowExceptionIfListNotFound

Switch parameter if an exception should be thrown if the requested list does not exist (true) or if omitted, nothing will be returned in case the list does not exist

Type:SwitchParameter
Position:Named
Accept pipeline input:False
Accept wildcard characters:False
-Web

The web to apply the command to. Omit this parameter to use the current web.

Type:WebPipeBind
Position:Named
Accept pipeline input:False
Accept wildcard characters:False

Outputs

Microsoft.SharePoint.Client.List