Quantcast
Viewing all articles
Browse latest Browse all 79

Finding out what service created a SharePoint site

SharePoint is the underpinning data storage for many Microsoft 365 services. Sites are are therefore created under the hood by many services.

Sometimes it it useful to know from where a site was created. We can actually find this in the SharePoint Online Admin Center. The column is however hidden by default, so you need to click Customize Columns and select to show “Created From”:

Image may be NSFW.
Clik here to view.

Note: This is a fairly new feature. It appears to have been added late 2020. Sites created earlier will have and empty field.

What if we wanted to get this information programmatically for all sites? Here is a solution written in PowerShell with the help of PnP PowerShell. It uses a hidden list on the Admin Center that aggregates all site collections in your tenant. Here we can find a field called

SiteCreationSource
  which is what we are looking for:
Connect-PnPOnline -Url https://TENANT-admin.sharepoint.com
$list = Get-PnpList -Identity "DO_NOT_DELETE_SPLIST_TENANTADMIN_AGGREGATED_SITECOLLECTIONS" -Includes Fields
$items = Get-PnPListItem -List $list

# Get all services here: https://TENANT-admin.sharepoint.com/_api/SPO.Tenant/GetSPOSiteCreationSources
$sources = @{
	"00000000-0000-0000-0000-000000000000" = "Unspecified"
	"09ABBDFD-ED23-44EE-A2D9-A627AA1C90F3" = "Planner"
	"00000002-0000-0FF1-CE00-000000000000" = "Outlook"
	"39966A89-5583-4E7F-A348-AF1BF160AE49" = "SP Admin Center"
	"A958918C-A597-4058-8AC8-8A98B6E58B45" = "SP Start Page"
	"CC15FD57-2C6C-4117-A88C-83B1D56B4BBE" = "Teams"
	"37C03F2D-EF6A-4BAF-B79D-58AB39757312" = "Hub Site"
}

$sites = @()
foreach( $item in $items )
{
    $site = [PSCustomObject] @{}
    $site | Add-Member -MemberType NoteProperty -Name "Title" -Value $item.FieldValues["Title"]
    $SiteCreationSource = $item.FieldValues["SiteCreationSource"].ToString()
    $site | Add-Member -MemberType NoteProperty -Name "SiteCreationSource" -Value $sources[$SiteCreationSource.ToUpper()]
    $site | Add-Member -MemberType NoteProperty -Name "SiteCreationSource GUID" -Value $SiteCreationSource.ToUpper()
    $sites += $site
}
$sites | Out-GridView

Not too difficult. Note that “SiteCreationSource” returns a GUID. We need to map this to a service. In the code I have simply hardcoded a few services. To get a list with all available services, this list can be queried:

https://TENANT-admin.sharepoint.com/_api/SPO.Tenant/GetSPOSiteCreationSources

Finally I want to point out that the site aggregation list contains a lot of useful information (besides being the easiest way to get a list of all sites). Some other fields that might be of interest: AllowGuestUserSignIn, ChannelType, ChannelSitesCount, ConditionalAccessPolicy, CreatedBy, CreatedByEmail, DeletedBy, ExternalSharing, FileViewedOrEdited, GroupId, HubSiteId, Initiator, IsGroupConnected, LastActivityOn, NumOfFiles, PageViews, PagesVisited, SensitivityLabel, SiteCreationSource, SiteId, SiteUrl, SiteOwnerEmail, SiteOwnerName, State, StorageQuota, StorageUsed, StorageUsedPercentage, TemplateName, TimeCreated, TimeDeleted, & RelatedGroupId.


Viewing all articles
Browse latest Browse all 79

Trending Articles