Skip to content

spo site list

Lists modern sites of the given type

Usage

spo site list [options]

Options

Option Description
--help output usage information
--type [type] type of modern sites to list. Allowed values TeamSite|CommunicationSite, default TeamSite
-f, --filter [filter] filter to apply when retrieving sites
-o, --output [output] Output type. json|text. Default text
--verbose Runs command with verbose logging
--debug Runs command with debug logging

Important

Before using this command, log in to a SharePoint Online tenant admin site, using the spo login command.

Remarks

To list modern sites, you have to first log in to a tenant admin site using the spo login command, eg. spo login https://contoso-admin.sharepoint.com. If you are logged in to a different site and will try to list the available sites, you will get an error.

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

spo site list

List all modern team sites in the currently connected tenant

spo site list --type TeamSite

List all modern communication sites in the currently connected tenant

spo site list --type CommunicationSite

List all modern team sites that contain project in the URL

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