Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/sharepoint/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Web services 使用SharePoint WebService访问列表时出错_Web Services_Sharepoint_List - Fatal编程技术网

Web services 使用SharePoint WebService访问列表时出错

Web services 使用SharePoint WebService访问列表时出错,web-services,sharepoint,list,Web Services,Sharepoint,List,我正在尝试使用web服务访问SharePoint列表,我需要通过web服务相应地更新该列表。下面是我正在使用的示例代码 Lists Testlist = new Lists(); Testlist.Credentials = System.Net.CredentialCache.DefaultNetworkCredentials; Testlist.PreAuthenticate = true; XmlNode myNode

我正在尝试使用web服务访问SharePoint列表,我需要通过web服务相应地更新该列表。下面是我正在使用的示例代码

        Lists Testlist = new Lists();

        Testlist.Credentials = System.Net.CredentialCache.DefaultNetworkCredentials; 

        Testlist.PreAuthenticate = true;

        XmlNode myNode = Testlist.GetList("sample list");  
        .
        .
        .  
但是,当我尝试使用web服务的Testlist.getList()方法时,我遇到了类型为“Microsoft.SharePoint.SoapServer.SoapServerException”的异常

我已经为它做了很多努力,但仍然没有找到合适的解决方案


有人能帮我解决这个问题吗…:(

看起来您已经通过添加WCF服务引用设置了web服务代理;我以前尝试过此方法,但没有成功。事实上,我打赌我们甚至会遇到相同的错误;我的错误是验证服务时出现问题

一旦我使用非WCF方法(添加Web引用)重新生成了代理,我就能够让一切正常工作

您可以通过与以前相同的方式向项目添加服务引用来完成此操作,除了在上,单击“高级…”按钮。这将打开

在这里,单击底部的按钮,然后指向列表服务并生成代理类

在代码中,实例化
列表
服务对象后,使用以下内容进行身份验证:

TestList.UseDefaultCredentials = true;
现在,您应该能够毫无例外地调用您的方法。如果您曾经偶然发现一种使用Visual Studio服务引用对SharePoint web services进行身份验证的正确方法,我很乐意听一听