我有一個任務開發 Windows應用程序將獲取從 SharePoint列表視圖數據和工作過程中贏得窗體應用程序中的數據.
我以前用於獲取數據使用Lists.asmx,views.asmx.
現在我才知道有其他的方式來獲取從列表視圖中的數據.
語法:
HTTPS://myserver.com / _vti_bin / owssvr.dll?CMD =顯示&名單 ={該列表}&View={View Id}&XMLDATA=true
Example URL:
HTTPS://myserver.com / _vti_bin / owssvr.dll?CMD =顯示&名單 ={EA1BD05B-DB5B-434B-B2FC-B9AB9EE18A91}&View={B959F555-798B-4F47-9FBB-81513B85F906}&XMLDATA=true
Now it will give the xml data as response.
write the response to xmldoc and process the data.
HttpWebRequest myRequest = (HttpWebRequest的)WebRequest.Create(“HTTPS://myserver.com / _vti_bin / owssvr.dll?CMD =顯示&名單 ={EA1BD05B-DB5B-434B-B2FC-B9AB9EE18A91}&View={B959F555-798B-4F47-9FBB-81513B85F906}&XMLDATA=true”);
myRequest.Credentials =
System.Net.CredentialCache.DefaultCredentials;
HttpWebResponse響應 = (HttpWebResponse)myRequest.GetResponse();
新的XmlDocument的XmlDocument doc的=();
doc.Load(response.GetResponseStream());
給一個答复