I feel like I'm very close on this one.
I know how to get the root site collection from this:
How can I get the root site collection from SPContext.Current?
I've been messing around with SPSiteDataQuery
, but this seems to be designed to get list items, not information about the parent list.
What I need is to get every SPList
for an entire Site. I need to get name, id and parentweb so that a user can select a list, and I can access it directly in the future by SPList:Guid
and ParentWeb:Guid
It seems easy to do this recursively by looping through SPContext.Current.Web.Site.WebApplication.Sites
and getting AllWebs
as shown here:
http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.splistcollection.aspx
Is this the best way to do this? It seems quite inefficient.