Search code examples
databasesharepoint-2013spwebspsitespsitedataquery

SharePoint 2013 - Getting SPSite.Url from SharePoint DB


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?


Solution

  • 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