Guest Developer
Guest Developer

Reputation: 1

How to List all web Applications Under a Sharepoint Server

Is There a way to get Lists of all web apps under a share point server. I am using client object model to develop application, with C#. So, is it possible to do that with client object model and if possible then how can i do this. or any other way to do this from client side.

Any help would be appreciated

Upvotes: 0

Views: 1445

Answers (1)

vinayak hegde
vinayak hegde

Reputation: 2242

I know using server object model.... It may help.............

   foreach (SPWebApplication webApplications in SPWebService.ContentService.WebApplications)
                           {
                               foreach (SPSite siteCollection in webApplications.Sites)
                               {
                                  foreach( SPWebCollection collWebsite in siteCollection.AllWebs){
                                   SPWebCollection collWebsite = site.AllWebs;
                                       foreach(SPWeb webSite in collWebsite)
                                          {
                                           // All web site
                                          }
                                    }
                                 }
                             }

Upvotes: 1

Related Questions