2010-08-19 58 views
0
ADO.NET數據服務

我試圖通過JavaScript從服務器獲取列表使用以下結合ORDERBY和擴大REST

var request = new Sys.Net.WebRequest(); 
request.set_httpVerb("GET"); 
//request.set_orderby("Created"); 
request.set_url("http://sps2010:39153/_vti_bin/ListData.svc/MyList?$expand=CreatedBy"); 
request.get_headers()['Accept'] = 'application/json'; 
request.add_completed(handleRequestComplete); 
request.invoke(); 

現在我要訂購以上列的一個,我可以訂購沒有使用擴展,即

request.set_url("http://sps2010:39153/_vti_bin/ListData.svc/MyList?$orderby=Created desc"); 

但我不能結合擴大和orderby ...奇怪的...任何想法?

+0

你會得到什麼錯誤? – 2010-08-19 11:27:45

+0

HTTP:// sps2010:39153/_vti_bin/ListData.svc/MYLIST $擴大= CreatedBy -OK 的http:// sps2010:39153/_vti_bin/ListData.svc/MYLIST $排序依據=創建 -OK http:// sps2010:39153/_vti_bin/ListData.svc/MyList?$ expand = CreatedBy $ orderby =已創建 - NOT OK 我得到HTTP 400「無法找到網頁」 – alittlebitofday 2010-08-20 00:01:12

回答

0

我找到了答案,以我自己的問題....這裏是你如何結合擴大和排序依據

http://sps2010:39153/_vti_bin/ListData.svc/MyList?$expand=CreatedBy&$orderby=Created 

容易真的一旦你知道如何... :)希望這會節省你們一段時間...