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
Sharepoint 调用GetListItems时出现SoapServerException_Sharepoint - Fatal编程技术网

Sharepoint 调用GetListItems时出现SoapServerException

Sharepoint 调用GetListItems时出现SoapServerException,sharepoint,Sharepoint,我正在尝试调用sharepoint网站中特定日历中的GetListItems。但是,每次尝试调用GetListItems时,我都会收到一个错误,错误是: Exception of type 'Microsoft.SharePoint.SoapServer.SoapServerException' 我的日历位于sharepoint网站中,其URL为: https://myteam.company.com/sites/TeamSite/Lists/Calendar 我的列表服务的url是: ht

我正在尝试调用sharepoint网站中特定日历中的GetListItems。但是,每次尝试调用GetListItems时,我都会收到一个错误,错误是:

Exception of type 'Microsoft.SharePoint.SoapServer.SoapServerException'
我的日历位于sharepoint网站中,其URL为:

https://myteam.company.com/sites/TeamSite/Lists/Calendar
我的列表服务的url是:

https://myteam.company.com/sites/TeamSite//_vti_bin/Lists.asmx
我调用getlistitems如下:

appSettings = ConfigurationManager.AppSettings;
credentials = new NetworkCredential(appSettings["Username"], appSettings["Password"]);
var doclist = new Lists() { Credentials = credentials, CookieContainer = new CookieContainer() };
var xmlDoc = new XmlDocument();
XmlElement query = xmlDoc.CreateElement("Query");
XmlElement viewFields = xmlDoc.CreateElement("ViewFields");
XmlElement queryOptions = xmlDoc.CreateElement("QueryOptions");
queryOptions.InnerXml = "<ViewAttributes Scope='Recursive'/>";
XmlNode doc = doclist.GetListItems("Lists", string.Empty, query, viewFields, "0", queryOptions, null);
appSettings=ConfigurationManager.appSettings;
凭据=新网络凭据(appSettings[“用户名”]、appSettings[“密码”]);
var doclist=new list(){Credentials=Credentials,CookieContainer=new CookieContainer()};
var xmlDoc=新的XmlDocument();
xmlementquery=xmlDoc.CreateElement(“查询”);
xmlement viewFields=xmlDoc.CreateElement(“viewFields”);
xmlement queryOptions=xmlDoc.CreateElement(“queryOptions”);
queryOptions.InnerXml=“”;
XmlNode doc=doclist.GetListItems(“列表”,string.Empty,查询,视图字段,“0”,查询选项,null);

调用getlistitems方法时,我总是会出错。我的代码有什么问题吗?谢谢。

啊,现在我知道怎么了;-)你的目标不是日历!因为日历存在于

https://myteam.company.com/sites/TeamSite/Lists/Calendar
您需要调用GetListItems方法,如下所示:

XmlNode doc = doclist.GetListItems("Calendar", string.Empty, query, viewFields, "0", queryOptions, null);

是的,从我的角度来看,代码看起来也不错。如果我查询的日历位于子文件夹中,我的列表服务的url是否不正确?我的列表服务的url是:而我试图查询的日历的url是:我必须返回给您确切的错误消息,但您认为我上面所说的是否有效?谢谢你说的子文件夹到底是什么意思?服务和日历都需要在同一个子网站(准确地说是SPWeb)中,以便服务可以找到列表。。这似乎是事实。找出问题所在——看看我的答案