I'm working directly against the SharePoint DB (I know it is highly not recommended but I need to, for several reasons).

I'm trying to get the SPSite.Url property ("http://baseurl/sites/somename") but can't figure out how to do that. I can only find and get the second part ("sites/somename") for each site.

Does any one know which stored procedures I need to use in order to get that?

  • Do you really need to get that directly from the db? Powershell can do that with ease. May 24, 2018 at 8:43
  • Yes I do... but can you please show me how to do that with Powershell anyway?
    – Amir M
    May 24, 2018 at 8:59
  • Do you want to get a list of all site collection available in a farm or a webapplication? May 24, 2018 at 9:28
  • @Christoffer yes
    – Amir M
    May 24, 2018 at 9:55
  • 1
    Sites in i a webapp: Get-spwebapplication -limit all | get-spsite -limit all May 24, 2018 at 10:02

1 Answer 1


The way to do that is: Retrieving the Farm Id--> Retrieving the Alternate URL Collection Ids--> Retrieving the Alternate URL Collections--> Alternate URL Matching

You can find in this link: [MS-WSSFO3]: Windows SharePoint Services (WSS): File Operations Database Communications Version 3 Protocol documentation with detailed explanation under this section:

Site Collection Lookup

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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