Skip to content

spo site list

Lists modern sites of the given type

Usage

m365 spo site list [options]

Options

-t, --type [type]
convenience option for type of sites to list. Allowed values are TeamSite,CommunicationSite.
--webTemplate [webTemplate]
type of sites to list. To be used with values like GROUP#0 and SITEPAGEPUBLISHING#0. Specify either type or webTemplate, but not both.
-f, --filter [filter]
filter to apply when retrieving sites
--includeOneDriveSites
use this switch to include OneDrive sites in the result when retrieving sites. Do not specify the type or webTemplate options when using this.
--deleted
use this switch to only return deleted sites
-h, --help [help]
Output usage information. Optionally, specify which section of command's help you want to see. Allowed values are options, examples, remarks, response, full. Default is full.
--query [query]
JMESPath query string. See http://jmespath.org/ for more information and examples
-o, --output [output]
Output type. json,text,csv. Default json
--verbose
Runs command with verbose logging
--debug
Runs command with debug logging

Important

To use this command you have to have permissions to access the tenant admin site.

Remarks

Using the -f, --filter option you can specify which sites you want to retrieve. For example, to get sites with project in their URL, use Url -like 'project' as the filter.

When using the text output type, the command lists only the values of the Title, and Url properties of the site. When setting the output type to JSON, all available properties are included in the command output.

Examples

List all sites in the currently connected tenant

m365 spo site list

List all group connected team sites in the currently connected tenant

m365 spo site list --type TeamSite

List all communication sites in the currently connected tenant

m365 spo site list --type CommunicationSite

List all group connected team sites that contain project in the URL

m365 spo site list --type TeamSite --filter "Url -like 'project'"

List all sites in the currently connected tenant including OneDrive sites

m365 spo site list --includeOneDriveSites

List all deleted sites in the tenant you're logged in to

m365 spo site list --deleted