Forum Discussion
marcin-260
Jan 25, 2024Copper Contributor
Calling the SPO Site ID?
Hello there, I'm trying to find the SPO site ID using PowerShell. I have tried using the following command, but it does not return any results. Get-PnPTenantSite| Where-Object {$_.Url -eq "...
marcin-260
Feb 09, 2024Copper Contributor
Thanks Nicolas, no results. It's does not contain any 'value' property even when pipping out as a full list.
Is this template specific? The one I'm looking at is SITEPAGEPUBLISHING#0?
Is this template specific? The one I'm looking at is SITEPAGEPUBLISHING#0?
ganeshsanap
Feb 09, 2024MVP
marcin-260 I think the site Id you are looking for is not returned using the Get-PnPTenantSite command. I even tried using -Detailed with the PowerShell command like below but it did not return the expected Id:
Get-PnPTenantSite -Detailed
You can try using Get-PnPSite like:
$SiteURL = "https://contoso.sharepoint.com/Sites/mysite"
#Connect to SP site
Connect-PnPOnline -Url $SiteURL -Interactive
#Get site ID
$Site = Get-PnPSite -Includes ID
#Print site ID
Write-host -f Green "Site ID: "$Site.Id
Please click Mark as Best Response & Like if my post helped you to solve your issue. This will help others to find the correct solution easily. It also closes the item. If the post was useful in other ways, please consider giving it Like.