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