SharePoint Site Hygiene Analysis: Inactive, Ownerless, and Duplicate Sites

Prev Next

Identify stale, unowned, and redundant SharePoint sites and produce an archive and cleanup plan.

Complexity: Intermediate. Impact: governance + storage-optimization + compliance + reporting.

Why use this workflow

SharePoint sprawl is a common governance problem in Microsoft 365 tenants. Over time, project sites outlive their projects, owners leave the company, and teams create near-duplicate sites because they cannot find the original. The result is storage growth, confused end users, stale content surfacing in search, and compliance risk from orphaned data.

This workflow scans every non-personal SharePoint site in the tenant and flags three classes of hygiene issues:

  • Inactive sites: no modifications in the last 90 days (configurable).
  • Ownerless sites: no user currently holds the Owner permission, which blocks self-service governance and membership changes.
  • Likely duplicates: sites with identical or near-identical display names, an indicator of redundant workspaces.

The output is a CSV report with a recommended disposition (Archive, Review, or Reassign Owner) for each flagged site, which gives you the input for a governance review cycle.

Run this on a regular cadence, before storage-quota renewals, or ahead of a tenant-to-tenant migration.

Expected outcomes

After completing this workflow you will have:

  • A full inventory of SharePoint sites in the tenant (excluding OneDrive personal sites).
  • A CSV report (SharePoint_Hygiene_Report.csv) listing every site with one or more issues, including URL, current owners, last-modified date, detected issues, and a recommended action.
  • Counts of total sites analyzed and total sites flagged, for reporting to stakeholders.
  • A prioritized list of candidates to archive (inactive), reassign (ownerless), or consolidate (duplicates).

You can hand the report to a governance steering committee or the site business owners for disposition sign-off.

Risks and considerations

Important considerations

  • Do not auto-delete based on this report. lastModifiedDateTime on a site can lag behind real user activity (for example, file views without edits). Require human sign-off before deletion.
  • Anonymized reporting. By default, Microsoft 365 admin reports conceal user and site names. If your hygiene data comes back with obfuscated names, clear the concealment setting under Settings > Org settings > Reports in the Microsoft 365 admin center, or PATCH /admin/reportSettings to set displayConcealedNames=false.
  • Legal hold and retention. Do not archive or delete sites under eDiscovery hold or a retention policy without consulting Compliance, even if they are flagged as inactive.
  • Duplicate detection is heuristic. Name-based matching produces false positives (for example, "HR" as a common prefix). Treat duplicate flags as candidates for review, not confirmed redundancy.
  • Ownership via permissions vs. group owners. Microsoft 365 group-connected sites derive owners from the backing group. The site permissions endpoint may show Owner roles differently than the group's owner list. Cross-reference both when a site is flagged ownerless.
  • API throttling. Large tenants can hit Graph throttling. Implement exponential backoff on 429 responses.

Required permissions

PermissionWhy it's needed
Sites.Read.AllEnumerate all SharePoint sites and read their metadata
Sites.FullControl.AllRead site permissions to determine ownership
Reports.Read.AllAccess SharePoint site usage and activity reports
ReportSettings.ReadWrite.AllDisable anonymized reporting so site names are visible in reports
Group.Read.AllResolve owners for Microsoft 365 group-connected sites

Ask Dex

Paste the prompt into a Dex conversation.

Prompt for IT admins

Analyze all SharePoint sites in our tenant for hygiene issues: flag sites that are inactive (no activity in the last {inactive_days} days), ownerless, or likely duplicates. Produce a CSV report with a recommended archive/reassign/consolidate action for each flagged site.

Manual steps (admin center)

The manual path combines the SharePoint admin center and the Microsoft 365 admin reports. It suits smaller tenants or spot-checking specific sites.

Step 1: Turn off anonymized reporting (once)

  1. Go to the Microsoft 365 admin center > Settings > Org settings > Services > Reports.
  2. Clear Display concealed user, group, and site names in all reports.
  3. Click Save.

Step 2: Pull the SharePoint site usage report

  1. Go to the Microsoft 365 admin center > Reports > Usage > SharePoint > Site usage.
  2. Set the date range to Last 90 days.
  3. Click Export to download the CSV.
  4. In the CSV, sort by Last activity date. Rows older than 90 days (or with no activity) are inactivity candidates.

Step 3: Identify ownerless sites

  1. Go to the SharePoint admin center > Sites > Active sites.
  2. Add the Primary admin column through the column picker if it is not visible.
  3. Filter or sort on Primary admin. Sites with a blank value are ownerless.
  4. For group-connected sites, also verify in the Microsoft 365 admin center under Teams & groups > Active teams & groups that the backing group has at least one owner.

Step 4: Detect likely duplicates

  1. In the SharePoint admin center, go to Sites > Active sites and click Export.
  2. Open the export in Excel, select the Site name column, and use Conditional Formatting > Highlight Cells Rules > Duplicate Values.
  3. Review the highlighted rows. The same name across different URLs is a duplicate signal.

Step 5: Build the disposition plan

  1. Combine the three lists into one spreadsheet and add a Recommendation column: Archive (inactive), Reassign Owner (ownerless), or Review for consolidation (duplicate).
  2. Circulate the plan to site business owners for sign-off before acting.

Microsoft Graph API

The Graph approach is the most scalable and produces a repeatable, scriptable report. All endpoints are against https://graph.microsoft.com/v1.0.

1. (Optional) Turn off concealed names

PATCH /admin/reportSettings
Content-Type: application/json

{
  "displayConcealedNames": false
}

Expected response: 204 No Content.

2. Enumerate all sites

GET /sites?search=*&$select=id,displayName,webUrl,lastModifiedDateTime

Follow @odata.nextLink until exhausted. Filter out personal sites by skipping any webUrl containing -my.sharepoint.com.

3. Check ownership per site

GET /sites/{site-id}/permissions

In the response, collect entries where roles includes "owner". If the filtered list is empty, flag the site Ownerless.

4. Pull the SharePoint site usage report (bulk activity)

GET /reports/getSharePointSiteUsageDetail(period='D90')

Returns CSV with Last Activity Date per site. Join on Site Id against the list from step 2. Flag any site whose last activity is more than 90 days ago (or null) as Inactive.

5. Duplicate detection

Normalize displayName (lowercase, trim whitespace) and group sites by the normalized key. Flag groups with more than one member as Likely Duplicate.

6. Build the report

For each site with one or more flags, emit a record:

{
  "SiteName": "Marketing Team",
  "Url": "https://contoso.sharepoint.com/sites/marketing",
  "Owners": "",
  "LastModified": "2024-02-11T09:14:00Z",
  "Issues": "Ownerless, Inactive (>90 days)",
  "Recommendation": "Archive"
}

Throttling

On a 429 Too Many Requests response, honor the Retry-After header and back off exponentially. For large tenants, batch the permission checks with the $batch endpoint (up to 20 requests per batch).

PowerShell

The approach uses the Microsoft.Graph PowerShell SDK to enumerate sites, check ownership, pull the usage report, detect duplicates, and export a CSV with recommendations.

Prerequisites

  1. Install the Graph SDK if you have not already:
    Install-Module Microsoft.Graph -Scope CurrentUser
  2. Connect with the required scopes:
    Connect-MgGraph -Scopes "Sites.Read.All", "Sites.FullControl.All", "Reports.Read.All", "ReportSettings.ReadWrite.All"
  3. (Optional) Turn off concealed names so the report contains real site names:
    Update-MgAdminReportSetting -DisplayConcealedNames:$false

Approach

  1. Enumerate sites. Use Get-MgSite -Search '*' -All to pull every site in the tenant, then filter out OneDrive personal sites.
  2. Check ownership. For each site, call Get-MgSitePermission and look for entries with the owner role.
  3. Activity check. Compare each site's LastModifiedDateTime against a configurable threshold (for example, 90 days).
  4. Duplicate detection. Group sites by normalized (lowercased, trimmed) display name and flag any name that appears more than once.
  5. Recommendation logic. Inactive: Archive. Ownerless only: Reassign Owner. Duplicate only: Review for consolidation. Multiple flags: Archive.
  6. Export. Write SharePoint_Hygiene_Report.csv to the output path.