Fix "Get-SPOSite : The managed path Sites/URL is not a managed path in this tenant." Error in SharePoint Online

Problem: Getting "Get-SPOSite: The managed path sites/URL is not a managed path in this tenant." error in PowerShell.

Get-SPOSite: The managed path sites-URL is not a managed path in this tenant.

Solution: 

A simple PowerShell script to get a site collection in SharePoint Online gave this error message. After a while, I noticed the error is because of the "/" character at the end of the $SiteURL parameter. It should be just the site URL without "/" at the end! So, the below PowerShell script works fine!

#Parameters
$AdminCenterURL = "https://crescentintranet-admin.sharepoint.com"
$SiteURL = "https://crescentintranet.sharepoint.com/sites/Marketing"

#Connect to SharePoint Online
Connect-SPOService -url $AdminCenterURL -Credential (Get-Credential)

#Get Site Collection
$Site = Get-SPOSite -Identity $SiteURL
This error also occurs when you provide a subsite URL, document library or list URL instead of a site collection URL for Get-SPOSite cmdlet. In other words, The Get-SPOSite or Set-SPOSite cmdlets can only be used to get a top-level site collection. It fails when you pass it with the url of a subsite or list.

No comments:

Please Login and comment to get your questions answered!

Powered by Blogger.