我想在 Sharepoint 2010(通过 svc)的站点集合中读出网站(标题)。我通过“listdata.svc”(http://www.xxx/websites/Web1Site/_vti_bin/Listdata.svc)获得列表信息。我如何获得网站?我正在寻找有关通过 sharepoint 使用 wcf 的良好资源。谢谢。
PS.:这是我当前的代码:
c_1steWebsitesammlungDataContext dataContext = new c_1steWebsitesammlungDataContext
(new Uri("http://www.xxx/websites/Web1Site/_vti_bin/listdata.svc/"));
dataContext.Credentials = CredentialCache.DefaultNetworkCredentials;
var result = from items in dataContext.BW_ScoreList01 select new
{ Name = items.NrFrage, items.Fragetext, items.Antwort1Wahl0 };
DataTable dt = new DataTable("myTable");
DataColumn column;
DataRow row;
column = new DataColumn();
//column.DataType = System.Type.GetType("String");
column.ColumnName = "NrFrage";
dt.Columns.Add(column);
column = new DataColumn();
//column.DataType = System.Type.GetType("String");
column.ColumnName = "Fragetext";
dt.Columns.Add(column);
column = new DataColumn();
//column.DataType = System.Type.GetType("String");
column.ColumnName = "Antwort1Wahl0";
dt.Columns.Add(column);
string a;
foreach (var item in result)
{
row = dt.NewRow();
a = item.Name.ToString();
row["NrFrage"] = a;
a = item.Fragetext.ToString();
row["Fragetext"] = a;
a = item.Antwort1Wahl0.ToString();
row["Antwort1Wahl0"] = a;
dt.Rows.Add(row);
}
dataGridView.DataSource = dt;