How do I get url of all the web application created in SharePoint 2010 with client object model using C#.
2 Answers
You can`t. The Client Object Model (CSOM) does not provide access above the Site Collection level.
As far as I know, the only way to do what you want is to create a custom web service that gets the Web Application information using the Server Object Model and have the remote application use it instead of the CSOM.
You can use below method to fetch all web applications:
var service = SPFarm.Local.Services.GetValue<SPWebService>(string.Empty);
foreach (SPWebApplication webApplication in service.WebApplications)
{
// using 'webApplication.Sites' you can get the result now.
}
you can also refer below url:
-
3This code uses the Server Object Model, not the Client Object Model Commented Aug 17, 2013 at 15:06