Enumerating of site collections (teamsites and project sites) the user has rights to see in different site collections without starting from SPWebApplication

Answered Enumerating of site collections (teamsites and project sites) the user has rights to see in different site collections without starting from SPWebApplication

  • Monday, May 30, 2011 6:39 AM
     
     

    Greetings!

    I was wondering, which way should one proceed in SharePoint 2010 if there's a need to enumerate all teamsite and project site collections and visualize them hierarchically? The team sites are different site collections and the visualization should be seen nearly anywhere if necessary. I know the root web application URL, to which all the team and project site belong to. My current solution/spike is a custom WCF service that returns JSON data to the web client, internally the WCF service grabs the SPWebApplication like this

    SPWebApplication.Lookup(new Uri("teamSitesUri"));

    and then go deeper into the hierarchy like

    foreach(SPSite tempSite in teamSitesWebApplication.Sites)

    foreach(SPWeb web in site.AllWebs)

    with the appropriate priviledge checks etc.

    But I'm afraid in a load balanced web farm environment this will be slow due to the excessive use of COM objects this solution necessiates. I've wondered if some SiteMapProvider variant is a better fit? Does anyone have an opinion whether I can accomplish this level of information retrieval using SiteMapProvider efficiently? Also it would be nice to know if I can still retain the efficiency of retrieving some SPList data etc. if needed.

    Any and all help and pointers are greatly appreciated. Thank you.



    Sudet ulvovat -- karavaani kulkee
    • Moved by Clayton Cobb - MVP Monday, May 30, 2011 8:04 AM Definitely not a General question (From:SharePoint 2010 - General Questions and Answers)
    •  

All Replies

  • Tuesday, June 07, 2011 10:25 AM
     
     Answered

    SiteMapProvider would be a nice solution.

    You may consider downloading the source code to SharePointManager to see how they do it, since they're essentially doing what you need to do.

    • Marked As Answer by Veksi Thursday, June 09, 2011 6:26 PM
    •  
  • Thursday, June 09, 2011 6:26 PM
     
     

    Hi!

    Nice to know I'm in the right direction, being a SP rookie and all. Thanks for the additional pointer to SharePointManager, I'll check that too.

    Sorry for the late reply, I'm on a holiday. :)


    Sudet ulvovat -- karavaani kulkee
  • Monday, April 09, 2012 5:17 PM
     
     

    Hi,

    Have you find out, how to get list of site collections using sitemapprovider.  If you have, then can you share your code in detail from start to end.  That would be really helpful.  Thanks in advance.


    Palak Jain

  • Saturday, April 14, 2012 11:38 AM
     
     

    Hi!


    Unfortunately things to prioritised a year or so back and I didn't get to implement the idea. I found, however, several links on different kinds of SiteMapProviders and the idea felt very implementable. An additional point was to use the provider in server and expose a WCF service to the UI, which would in turn format the contents. So, an approach a bit like Wictor Wilén describes in hist post Calling a WCF Service using jQuery in SharePoint - the correct way.

    I'd be glad to write more or provide the links here, but alas, I don't have them right now. If it helps, searching them around the web and trying to form a picture how to do it was around one day. If my memory serves me correctly, there were already examples on "collecting crumb paths" on the server like this and then using it for other purposes.

    I hope this helps. If you get something, please do share (though I haven't done SP development since those days). :)


    Sudet ulvovat -- karavaani kulkee