我正在制作一个 Windows 窗体应用程序来检索有关列表项的详细信息。我编写了代码并且它的运行没有错误,但是即使列表中有项目,它也返回 0 个项目谁能告诉我可能是什么原因?
这是我得到的 xml 响应:
<listitems xmlns:s="uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:rs="urn:schemas-microsoft-com:rowset" xmlns:z="#RowsetSchema" xmlns="http://schemas.microsoft.com/sharepoint/soap/">
<rs:data ItemCount="0">
</rs:data>
</listitems>
这是代码:
Dim listService As New Lists()
listService.Credentials = System.Net.CredentialCache.DefaultCredentials
listService.Url = "http://sitename/_vti_bin/lists.asmx"
Dim xmlDoc As New System.Xml.XmlDocument()
Dim listName As String = "{83FEDC7E-1DDA-4A36-910A-D5140E51F0ED}"
Dim viewName As String = "{77A23176-5CD4-46E9-BE57-AEB4D4279AD4}"
Dim rowLimit As String = "150"
Dim query As System.Xml.XmlNode = xmlDoc.CreateElement("Query")
Dim viewFields As System.Xml.XmlNode = xmlDoc.CreateElement("ViewFields")
Dim queryOptions As System.Xml.XmlNode = xmlDoc.CreateElement("QueryOptions")
query.InnerXml = "<Query><Where><Contains><FieldRef Name='Title'/><Value Type='Text'>lol</Value></Contains></Where></Query>"
viewFields.InnerXml = ""
queryOptions.InnerXml = "<ViewAttributes Scope='Recursive' />"
Dim nodeListItems As XmlNode
nodeListItems = listService.GetListItems(listName, viewName, query, viewFields, rowLimit, queryOptions, Nothing)
TextBox1.Text += nodeListItems.OuterXml
更新: *错误是我在凭据的同一字段中提供了域和用户名。*