Skip to content

spo site list

Lists modern sites of the given type

Usage

m365 spo site list [options]

Options

--type [type]
type of modern sites to list. Allowed values TeamSite,CommunicationSite, default TeamSite
-f, --filter [filter]
filter to apply when retrieving sites
--deleted
use this switch to only return deleted sites
-h, --help
output usage information
--query [query]
JMESPath query string. See http://jmespath.org/ for more information and examples
-o, --output [output]
Output type. json,text. Default text
--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 (default), 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 modern team sites in the currently connected tenant

m365 spo site list

List all modern team sites in the currently connected tenant

m365 spo site list --type TeamSite

List all modern communication sites in the currently connected tenant

m365 spo site list --type CommunicationSite

List all modern team sites that contain project in the URL

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

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

m365 spo site list --deleted