调用 GetListItems 时发生 SoapServerException [英] SoapServerException when calling GetListItems
问题描述
我正在尝试在 sharepoint 站点的特定日历中调用 GetListItems.但是,每次我尝试调用 GetListItems 时,都会收到一条错误消息:
I am trying to call GetListItems in a specific calendar in sharepoint site. However everytime I try to call GetListItems I get an error saying:
Exception of type 'Microsoft.SharePoint.SoapServer.SoapServerException'
我的日历位于一个共享点站点,其 URL 为:
My calendar is in a sharepoint site whose URL is:
https://myteam.company.com/sites/TeamSite/Lists/Calendar
我的列表服务网址是:
https://myteam.company.com/sites/TeamSite//_vti_bin/Lists.asmx
我调用 getlistitems 如下:
And I call getlistitems as follows:
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);
我在调用 getlistitems 方法时总是出错.我的代码有什么问题吗?谢谢.
I always get an error when calling the getlistitems method. Is there anything wrong with my code? Thanks.
推荐答案
啊现在我知道出了什么问题 ;-) 你没有针对日历!因为日历存在于
ah now i know what's wrong ;-) you aren't targeting the calendar! since the calendar exists under
https://myteam.company.com/sites/TeamSite/Lists/Calendar
你需要调用GetListItems方法如下:
you need to call the GetListItems method as followed:
XmlNode doc = doclist.GetListItems("Calendar", string.Empty, query, viewFields, "0", queryOptions, null);
这篇关于调用 GetListItems 时发生 SoapServerException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!