我想通過Web服務訪問Sharepoint的列表。在Sharepoint Online上訪問Sharepoint Webservice的列表2013
我已經爲我的網絡服務嘗試了很多不同的Web引用URL。
的列表中找到在:
example.com/sites/dms/_layouts/15/start.aspx#/Lists/Documents/AllItems.aspx
我使用的Web服務的URL現在是
https://example.com/sites/dms/_vti_bin/lists.asmx
顯然example.com是不是真正的URL。
當我運行的代碼
service.GetList("Documents");
我得到的錯誤:
List does not exist.
The page you selected contains a list that does not exist. It may have been deleted by another user.
0x82000006
我完整的代碼(很多東西都只是爲了測試目的):
public void UpdateList()
{
MKLists.Lists service = GetService();
string targetSite = "https://mywebpage.com/sites/dms";
using (ClientContext ctx = ClaimClientContext.GetAuthenticatedContext(targetSite))
{
if (ctx != null)
{
ctx.Load(ctx.Web); // Query for Web
ctx.ExecuteQuery(); // Execute
string test = (ctx.Web.Title);
}
}
CookieCollection authCookie = ClaimClientContext.GetAuthenticatedCookies(targetSite, 925, 525);
service.CookieContainer = new CookieContainer();
service.CookieContainer.Add(authCookie);
XmlNode tester = service.GetList("Documents");
}
private MKLists.Lists GetService()
{
MKLists.Lists myService = new MKLists.Lists();
myService.Credentials = System.Net.CredentialCache.DefaultCredentials;
return myService;
}
Stakoverflow已開發的Sharepoint網站,你應該問它在那裏你會得到正確的答案更多的在那裏。 –