HarePoint Explorer for SharePoint - Where is the list of sites located in the object model?
 

Where is the list of sites located in the object model?

Probably, the first question, which a developer can ask at the first launch of HarePoint Explorer for SharePoint, is going to be the following: "And where are the sites here?"

The answer is simple. In order to find the list of sites created in SharePoint, the following must be done:

  1. Find and expand node that conforms to property Services.
  2. Expand node Collection Items to get the list of services included in SharePoint farm.
  3. In the list of services find service, the name of which starts with SPWebService Parent=SPFarm Name=SharePoint_Config_.
  4. Expand node of property WebApplications containing the list of web-applications.
  5. In node Collection Items find object with the name SPWebApplication Name=SharePoint - 80 Parent=SPWebService.
  6. Expand node of property Sites. This node contains the list of site collections created in the context of previously selected web-application.
  7. In node Collection Items select one of the collections.
  8. And finally, by expanding AllWebs, Collection Items sequentially, we will see the necessary list of sites.

From the first sight, this process may appear as complicated and tiresome. But attention must be paid to the fact that even during realization of such simple task, we get a lot of information about the object model of SharePoint! Particularly, it becomes clear that besides web-services, there are many other useful services in SharePoint: diagnostic services, timers, administrative services, etc. It is obvious that there can be a lot of web-applications, site collections and other items of infrastructure. All this information is irreplaceable for proper development of SharePoint solutions. Also it is important that all this information we get without write a single line of code, without any tests!