I would like to be able to determine if a SharePoint web application URL is a SharePoint online instance or not.

Previously, I used to think that you could check to see if a sharepoint web application URL had the form https://{tenantname}.sharepoint.com to see if it was a sharepoint online instance URL.

But now I've seen Office 365 sharepoint online urls that looks like https://prefix.mycompany.com.

Is there some simple way to check a URL for sharepoint online versus sharepoint on prem?

I'd rather not have to add a "SharePoint Online" checkbox in my UI.

2 Answers 2


For most circumstances, If it is SPO, it is cloud SharePoint and contains 'sharepoint.com' as part of the FQDN. Anything else shall be on-prem SharePoint. If there are custom domains with a URL like you mentioned not containing sharepoint.com, you may check the server version via csom, From the number returned (example: the most important part is the first number.

12 = SharePoint 2007 (WSS or MOSS)

14 = SharePoint 2010

15 = SharePoint 2013

16 = SharePoint 2016, and generally SharePoint Online / Office 365

I am not sure if there are other ways to tell the difference with a programmatic way.

  • ok that's what i thought too. i will use the headers to find some sort of "definite" sharepoint online header. I need to make sure it is something that won't lock in my code to sharepoint online. i think i will just make the users enter a checkbox "is sharepoint online" so that it will work after that header might change one day Aug 13, 2019 at 12:39

Not from the URL. But you can from a web service call, or by looking at the data returned in the HTTP header.

Data returned in the header of a GET request. This is from SPO:


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.