--- title: "List All SharePoint Sites in a Microsoft 365 Tenant" slug: "dex-wf-list-all-sharepoint-sites" updated: 2026-11-30T16:12:54Z published: 2026-11-30T16:12:54Z canonical: "documentation.sysaid.com/dex-wf-list-all-sharepoint-sites" --- > ## Documentation Index > Fetch the complete documentation index at: https://documentation.sysaid.com/llms.txt > Use this file to discover all available pages before exploring further. # List All SharePoint Sites in a Microsoft 365 Tenant Enumerate every SharePoint site collection in your tenant and export to CSV for governance, auditing, and cleanup planning. **Complexity:** Beginner. **Impact:** read-only + reporting + governance + safe. ## Why use this workflow Knowing which SharePoint sites exist in your tenant is the foundation of any governance, storage optimization, or security review. Over time, tenants accumulate sites from Teams creation, project provisioning, one-off communication sites, and legacy migrations. Common scenarios where you need a full site inventory: - **Storage planning:** identifying which sites consume the most SharePoint quota - **Stale site cleanup:** finding sites that have not been touched for a long time - **Security audits:** reviewing external sharing, permissions, and sensitive content per site - **Migration prep:** baselining before a tenant-to-tenant move or restructuring - **Compliance reporting:** producing an authoritative list for auditors This workflow produces a CSV of every site with its display name, web URL, and site ID. It is the starting point for downstream governance tasks. ## Expected outcomes - A complete list of all SharePoint site collections in the tenant - A CSV export (`sharepoint_sites_list.csv`) with Display Name, Web URL, and Site ID columns - A count of total active sites for capacity and license planning - A reusable baseline you can feed into follow-up workflows (usage reports, sharing audits, archival) ## Risks and considerations ### Things to watch for - **Search-based enumeration has limits.** `GET /sites?search=*` returns sites indexed by SharePoint search and excludes the root site and some system sites. For a more exhaustive list (including personal OneDrive sites), use `GET /sites/getAllSites` (beta) or PnP PowerShell's `Get-PnPTenantSite`. - **Large tenants require pagination.** Follow `@odata.nextLink` until it is absent. - **OneDrive personal sites** are technically site collections but are usually filtered out of governance inventories. If you need them, filter on `isPersonalSite`. - **Read-only operation.** This workflow only enumerates. It does not modify any site. - **Data sensitivity.** Site URLs can reveal project names and confidential initiatives. Treat the exported CSV as confidential. ## Required permissions | Permission | Why it's needed | | --- | --- | | Sites.Read.All | Required to enumerate all SharePoint site collections via Microsoft Graph | | SharePoint Administrator (role) | Needed if using the SharePoint admin center or SharePoint PnP PowerShell cmdlets | ## Ask Dex Paste the prompt into a Dex conversation. ### Prompt for IT admins ``` List every SharePoint site in our tenant and export the results to CSV. Include display name, web URL, and site ID. Flag any sites that look like they might be stale or duplicates. ``` ## Manual steps (admin center) 1. Sign in to the [Microsoft 365 admin center](https://admin.microsoft.com) with a Global Administrator or SharePoint Administrator account. 2. In the left navigation, expand **Admin centers** > **SharePoint**. This opens the SharePoint admin center at `https://{tenant}-admin.sharepoint.com`. 3. In the SharePoint admin center, go to **Sites** > **Active sites**. 4. The Active sites page lists the site collections in the tenant with columns such as *Site name*, *URL*, *Storage used*, *Primary admin*, *Hub*, *Template*, *Last activity*, and *Date created*. Use the column chooser to show or hide fields. 5. To filter, use the filter pane on the right (by template, hub, sensitivity label, and so on) or type in the search box at the top. 6. To export the full list to CSV, click **Export** in the command bar. 7. For deleted sites, go to **Sites** > **Deleted sites**. **Tip!** The Active sites view does not include personal OneDrive sites. For those, use **More features** > **User profiles** > **Manage User Profiles** or the Graph API approach below. ## Microsoft Graph API Microsoft Graph exposes SharePoint sites under `/sites`. The fastest way to list every site indexed by search is the `search` query parameter. ### Single-page request ``` GET https://graph.microsoft.com/v1.0/sites?search=*&$select=displayName,webUrl,id Authorization: Bearer {access_token} ``` ### Example response ``` {  "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#sites",  "@odata.nextLink": "https://graph.microsoft.com/v1.0/sites?search=*&$skiptoken=...",  "value": [    {      "id": "contoso.sharepoint.com,fd008f7d-...,314f0ec2-...",      "displayName": "Marketing Internal",      "webUrl": "https://contoso.sharepoint.com/sites/MarketingInternal"    }  ] } ``` ### Pagination When the response contains `@odata.nextLink`, send a GET request to that URL to retrieve the next page. Continue until `@odata.nextLink` is absent. ### Alternative: complete enumeration (beta) ``` GET https://graph.microsoft.com/beta/sites/getAllSites ``` This beta endpoint returns every site collection, including those not surfaced by search. ### Required permission - `Sites.Read.All` (application or delegated) ## PowerShell You have two options. The **Microsoft Graph PowerShell SDK** uses the same Graph endpoint as the API section. **SharePoint PnP PowerShell** (`Get-PnPTenantSite`) uses the SharePoint tenant admin endpoint and catches sites that Graph search misses. ### Option A: Microsoft Graph PowerShell SDK ``` # Install once Install-Module Microsoft.Graph -Scope CurrentUser # Connect with Sites.Read.All Connect-MgGraph -Scopes "Sites.Read.All" # List all sites (handles pagination automatically with -All) $sites = Get-MgSite -Search "*" -All -Property displayName,webUrl,id $sites | Select-Object displayName,webUrl,id |  Export-Csv -Path ".\sharepoint_sites_list.csv" -NoTypeInformation ``` ### Option B: SharePoint PnP PowerShell (most complete) ``` Install-Module PnP.PowerShell -Scope CurrentUser Connect-PnPOnline -Url "https://{tenant}-admin.sharepoint.com" -Interactive Get-PnPTenantSite | Select-Object Title,Url,Template,StorageUsageCurrent,LastContentModifiedDate |  Export-Csv -Path ".\sharepoint_sites_list.csv" -NoTypeInformation ``` The PnP approach also returns storage, template, and last-modified data in the same call.