public DataTable
GetAllWebApplication()
{
DataTable dt = new DataTable();
dt.Columns.Add(“URL”);
dt.Columns.Add(“Title”);
SPSecurity.RunWithElevatedPrivileges(delegate()
{
SPWebServiceCollection webServices = new SPWebServiceCollection(SPFarm.Local);
foreach (SPWebService webService in webServices)
{
foreach (SPWebApplication wa in webService.WebApplications)
{
dt.Rows.Add(new object[] { wa.GetResponseUri(SPUrlZone.Default).AbsoluteUri, wa.Name });
}
}
{
DataTable dt = new DataTable();
dt.Columns.Add(“URL”);
dt.Columns.Add(“Title”);
SPSecurity.RunWithElevatedPrivileges(delegate()
{
SPWebServiceCollection webServices = new SPWebServiceCollection(SPFarm.Local);
foreach (SPWebService webService in webServices)
{
foreach (SPWebApplication wa in webService.WebApplications)
{
dt.Rows.Add(new object[] { wa.GetResponseUri(SPUrlZone.Default).AbsoluteUri, wa.Name });
}
}
});
return dt;
}
}
No comments:
Post a Comment