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 "...
Jan 29, 2024
That's probably due to it not getting any results.
Try this and see if you get any value, else it's not matching on your URL:
$mySite = Get-PnPTenantSite| Where-Object {$_.Url -eq "https://companydomainsharepoint.com/sites/mysite"}
$mySite.value
Try this and see if you get any value, else it's not matching on your URL:
$mySite = Get-PnPTenantSite| Where-Object {$_.Url -eq "https://companydomainsharepoint.com/sites/mysite"}
$mySite.value
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?
- ganeshsanapFeb 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 -DetailedYou 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.