Sunday, February 12, 2012

Get a List of Web Applications in a SharePoint Farm

Code to iterate through all the web applications in a SharePoint Farm         

              SPFarm farm = SPWebService.ContentService.Farm;
               SPWebApplicationCollection webAppColl = SPWebService.ContentService.WebApplications;
               if (webAppColl != null)
               {
                   foreach (SPWebApplication spWebApp in webAppColl)
                   {
                       lst.Items.Add(new ListItem(spWebApp.AlternateUrls[0].Uri.ToString()));
                   }
                   radCmbWebApplications.Items.Insert(0, new RadComboBoxItem(" -- Select a WebApplication -- ", "-1"));

               }

No comments:

Post a Comment

Access to XMLHttpRequest at 'from origin has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https. .net core angular

Issue: The angular application was getting error from API that the origin has been blocked by CORS policy. Solution: Make sure that the...