How to remove orphaned SharePoint Online Site Redirection Url
Simple job
When I was trying to create a new SharePoint site, I was getting a message “This site address is available with modification.”
When I’ve checked for the site called “Operations” I was getting “404 FILE NOT FOUND” error. So, the site doesn’t exits and I’m unable to re-use this Url.
Not so simple job
Next, I’ve checked for Url redirects.
Get-SPOSite -Template REDIRECTSITE#0
And here it was.
According to Microsoft documentation, I should be able to remove it with this command:
Remove-SPOSite -Identity https://domain.sharepoint.com/sites/Operations
That didn’t worked for me. I was getting this error:
Remove-SPOSite : Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))
Access is denied
Looks like permissions issue. After, I’ve added my admin account as a “Site Collection Administrator”
Set-SPOUser -Site https://domain.sharepoint.com/sites/operations -LoginName arturo@domain.com -IsSiteCollectionAdmin $true
I was able to remove the Site and free up the Url.
Get-SPOSite -Identity https://domain.sharepoint.com/sites/operations | Remove-SPOSite