Let's have, for example, this url:
Is there an efficient way to analyse this full url to extract site and web url?
- The web application url is
http://corp.com(this one is easy to find, as it's the scheme + host)
- The site url is
- The web url is
SPContext is available, this is easy, but what about an external application? Typically, what about from a PowerShell script?
$fullUrl = "http://corp.com/sites/project1/documents/forms/allitems.aspx" $siteUrl = ___($fullUrl) $site = Get-SPSite $siteUrl
I know I could play with
Get-SPSite -Limit All and compare url, but it may be tricky when nesting site collection, or have a large number of site collection.
Actually, I'm hoping Microsoft have an utility class that will do the job (but I didn't find it yet).