tags:

views:

97

answers:

2

I don't suppose there's a way to get at the SPFarm through the OOTB web services? I've got some external code that I want to search an entire farm looking for particular feature that has been activated at site level. Then to go to a document library that the feature creates and copy all the documents into another SQL database. The feature can be activated many times and I don't know where it's been activated for a given deployment hence the searching from top to bottom for all occurences.

The web services are exposed for each web application, but I don't know how to (using web services) enumerate all the web applications and so on down to the site level without having a list of all available web applications in the first place. Any suggestions?

+2  A: 

The web services are limited enough in many ways that the hassle of creating your own custom web service is worth it when trying complicated functions.

Nat
+2  A: 
SPWebService contentService = SPWebService.ContentService;
foreach(SPWebApplication app in contentService.WebApplications) 
{
  if (app.Sites.Count > 0) 
  {

    // pick the first site (root site)
    SPSite rootSite = app.Sites[0];

    Trace.WriteLine(site.Url);
  }
}

Edit: You will need to write your own web service to do this though and then deploy it to the (central admin) web application as a feature.

Colin