2014-02-18 83 views
-1

我想通过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; 
    } 
+0

Stakoverflow已开发的Sharepoint网站,你应该问它在那里你会得到正确的答案更多的在那里。 –

回答

0

改变这line:

MKLists.Lists service = GetService(); 

MKLists.Lists service = new MKLists.Lists(); 

我希望这有助于。

编辑

根据在这里回答您的评论

是更新@迈克尔 试着改变你的targetsite网址

string targetSite = "https://mywebpage.com/sites/dms/_vti_bin/Lists.asmx"; 

希望这一次它有助于

+0

对不起。 GetServices)是我编写的一个辅助方法。我已编辑的问题,以显示此 – michael

+0

@ michael检查我的答案中的编辑部分 –

0

事实证明这是与子网站......这条线解决了它:

service.Url = "https://mywebpage.com/sites/dms/_vti_bin/lists.asmx"; 
相关问题