1

I want to create a list of all subsites (all levels), and some details about each of them. The simplest way is to do a recursive function, but I have many subsite (about 600) and I want a more efficient way.

Is SPSiteDataQuery may be appropriate in such a case?

2 Answers 2

1

I haven't used SPSiteDataQuery, but I have used PowerShell to return a list of all subsites from a SharePoint Web Application (it returns the title, url, and id of each) and saves it to a CSV file:

Get-SPWebApplication "http://webappname/" | Get-SPSite -Limit All | Get-SPWeb -Limit All | Select Title, URL, ID | Export-CSV C:\IterateAllSitesSubsites.ps1.csv -NoTypeInformation

2
  • It works. Do you know if there is corresponding code in C#?
    – banana
    Commented Oct 11, 2012 at 7:48
  • 1
    I found this link which explains how to find this information using C#. Also, this article from MSDN might help.
    – ajbillings
    Commented Oct 11, 2012 at 15:41
0

I researched a way to do this before. In my case I needed to get a list of all sites across all site collections and even between multiple farms. I ended up creating my own timer job that ran every hour to update a database where I stored the structure. Also, every evening I ran another timer job to store in a different table who has access to read what site. That way I can easily create a "my team sites" webpart which quickly displays all of the sites a user has access to. With this setup and some column indexing I was able to get my webpart to run in under 2 seconds and sometimes displaying thousands of team sites.

1
  • It's a good idea, but does not exactly fit my needs. Thanks anyway.
    – banana
    Commented Oct 11, 2012 at 7:56

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.