I want to read out websites (titel) in a sitecollection in Sharepoint 2010 (by svc). I get the listinfo by "listdata.svc" (http://www.xxx/websites/Web1Site/_vti_bin/Listdata.svc). How I get the websites? I am looking for a good source about using wcf by sharepoint. thanks.
PS.: this is my current code:
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;