I am looking for the siteID in admin center of sharepoint and I cannot find it. I can get it via graphAPI but I need to find it via admin center as well, and the reason is our customer has multi-tenant application and they want each tenant enter their own sharepoint/graphAPI settings in the application.
3 Answers
1
votes
I don't believe it is possible to get the site Id for SharePoint Online sites from the SPO admin center. You can use Microsoft Graph, SharePoint Online PowerShell, Client Side Object Model (CSOM), and more. Additionally if you navigate to a site in a browser and append "/_api/site" to the URL you can see the Guid for the site, but you'll need to parse the XML response.
1
votes
It seems that there is not a way to get site id in CA.
I write a pnp powershell script to get all site id for your reference.
$username = "[email protected]"
$password = "Password"
$cred = New-Object -TypeName System.Management.Automation.PSCredential -argumentlist $userName, $(convertto-securestring $Password -asplaintext -force)
$TenantSiteURL = "https://contoso-admin.sharepoint.com/"
$CSVFilePath = "C:\Temp\AllSitesData.csv"
#Connect to Tenant Admin Site
Connect-PnPOnline -Url $TenantSiteURL -Credentials $cred
$sites=Get-PnPTenantSite -Detailed
$listItemData=@()
foreach($site in $sites){
Connect-PnPOnline -Url $site.Url -Credentials $cred
#Get the site collection with ID property
$Site = Get-PnPSite -Includes ID
$listItemData += New-Object PSObject -Property @{
"Site Url" = $site.Url
"Site Collection ID" = $Site.Id
}
}
$listItemData |Export-Csv -NoTypeInformation -Path $CSVFilePath