Office 365 / SharePoint Online – Get-SPOSite : The site ‘SiteUrl’ is not properly formed.

Hi All,

Today new issue and solution 🙂

For my SharePoint online site, I need to set the one of the property through PowerShell. So I am trying to get the Site using Get-SPOSite as

PS C:\WINDOWS\system32> $site = Get-SPOSite 
"https://youcando.sharepoint.com/teams/youcandoteam/"

but I am getting following error as

Get-SPOSite : The site https://youcando.sharepoint.com/teams/youcandoteam/ is not properly formed.
At line:1 char:9
+ $site = Get-SPOSite “https://youcando.sharepoint.com/teams/youcandote …

+ CategoryInfo : NotSpecified: (:) [Get-SPOSite], ServerException
+ FullyQualifiedErrorId : Microsoft.SharePoint.Client.ServerException,Microsoft.Online.SharePoint.PowerShell.GetSite

fig1-error

Fig 1 : Office 365 / SharePoint Online – Error “The site is not well formed”

After googling, in one of the blog found that use “Identity” element before the URL, so we tried as

$site = Get-SPOSite 
-Identity "https://youcando.sharepoint.com/teams/youcandoteam/"

but no luck 🙁

same error as – Get-SPOSite : The site ” is not properly formed as.

fig2-identity_error

Fig 2 : Office 365 / SharePoint Online – Error “The site is not well formed” even though ‘-Identity’ parameter is used before

After googling bit more in one of the blog found that , remove the trailing “/” from the URL and it worked like charm 🙂 as

fig3-solution
Fig 3: Office 365 / SharePoint Online – after removing the trailing “/”  Get-SPOSite worked

This is easiest solution but thought to share since it took my around an hour to solve this.

Thanks for reading 🙂

Keep reading, share your thoughts, experiences. Feel free to contact us to discuss more. If you have any suggestion / feedback / doubt, you are most welcome.

Stay tuned on Knowledge-Junction, will come up with more such articles / news

Prasham Sabadra

LIFE IS VERY BEAUTIFUL. ENJOY THE WHOLE JOURNEY :) Founder of Microsoft 365 Junction, Speaker, Author, Learner, Developer, Passionate Techie. Certified Professional Workshop Facilitator / Public Speaker. Believe in knowledge sharing. Around 20+ years of total IT experience and 17+ years of experience in SharePoint and Microsoft 365 services Please feel free me to contact for any SharePoint / Microsoft 365 queries. I am also very much interested in behavioral (life changing) sessions like motivational speeches, Success, Goal Setting, About Life, How to live Life etc. My book - Microsoft 365 Power Shell hand book for Administrators and Beginners and 100 Power Shell Interview Questions - https://www.amazon.in/Microsoft-Administrators-Beginners-Interview-Questions/dp/9394901639/ref=tmm_pap_swatch_0?_encoding=UTF8&qid=1679029081&sr=8-11

You may also like...

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.