这是我的函数,为什么我没有得到子文件夹,虽然我使用递归ALL选项。
我甚至没有获得1级子文件夹我只获得主文件和文件夹,我确信我在肥皂请求中有问题,但我无法理解。
我使用了与此question
相同的请求Function getResults(url, xmlDoc, spreturnattribute)
request = "<?xml version='1.0' encoding='utf-8'?>" & _
"<soap:Envelope xmlns:soap='http://www.w3.org/2003/05/soap-envelope' xmlns:soap1='http://schemas.microsoft.com/sharepoint/soap/'>" & _
" <soap:Header/>" & _
" <soap:Body>" & _
" <soap1:GetListItems>" & _
" <soap1:listName>Documents</soap1:listName>" & _
"<QueryOptions>" & _
"<IncludeMandatoryColumns>TRUE</IncludeMandatoryColumns>" & _
"<ViewAttributes Scope='RecursiveAll'/>" & _
"<DateInUtc>TRUE</DateInUtc>" & _
"</QueryOptions>" & _
"</soap1:GetListItems>" & _
"</soap:Body>" & _
"</soap:Envelope>"
With CreateObject("Microsoft.XMLHTTP")
.Open "Get", url, False, Null, Null
.setRequestHeader "Content-Type", "text/xml; charset=utf-8"
.setRequestHeader "SOAPAction", "http://schemas.microsoft.com/sharepoint/soap/GetListItems"
.send request
xmlDoc.setProperty "SelectionLanguage", "XPath"
xmlDoc.async = False
xmlDoc.validateOnParse = False
xmlDoc.resolveExternals = False
xmlDoc.setProperty "SelectionNamespaces", "xmlns:s='uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882' xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/' xmlns:namespace='http://schemas.microsoft.com/sharepoint/soap/' xmlns:rs='urn:schemas-microsoft-com:rowset' xmlns:z='#RowsetSchema'"
xmlDoc.LoadXML (.responseText)
Dim strQuery: strQuery = ".//z:row"
Set colItem = xmlDoc.SelectNodes(strQuery)
For Each objItem In colItem
Debug.Print objItem.Attributes.getNamedItem("ows_LinkFilename").Text
For Each queryNode In objItem.ChildNodes
Debug.Print queryNode.Attributes.getNamedItem("ows_LinkFilename").Text
Next
Next
End With
End Function
添加参考文章
答案 0 :(得分:1)
您可能需要为查询指定“rowLimit”参数。
您可以设置特定号码
<rowLimit>5000</rowLimit>
或使用
获取所有项目<rowLimit>0</rowLimit>
rowLimit区分大小写。
答案 1 :(得分:0)
尝试
Recursive
了解ViewAttributes的范围
<ViewAttributes Scope='Recursive'/>
答案 2 :(得分:0)
经过多次试用,我已删除了所有额外未使用的标签,并检查了msdn上的链接 并通过添加另一个标签queryoptions来更新我的caml,如下所示解决了我的问题:
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<GetListItems xmlns="http://schemas.microsoft.com/sharepoint/soap/">
<listName>listname</listName>
<FieldRef Name="FSObjType" /><Value Type="int">1</Value>
<rowLimit>0</rowLimit>
<queryOptions><QueryOptions> <IncludeMandatoryColumns>FALSE</IncludeMandatoryColumns>
<ViewAttributes Scope="RecursiveAll"></ViewAttributes></QueryOptions></queryOptions>
</GetListItems>
</soap:Body>
</soap:Envelope>