This is my function why I don't get the subfolders although I'm using recursive ALL option.
I don't even obtain 1-level subfolders I only get the main files and folders, I'm sure I've something wrong in soap request but I can't figure it out.
I've used the same request as this 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
Edit1
Adding reference article
Edit2
may that due to security issue on the site ? or does setting xmldoc properties cause that? I'm not very good at VBA but it's an easy script and I wonder why it's not working and FYI my sharepoint is 2013
After alot of trials I've removed all extra unused tags and just checked that link on msdn and updated my caml by adding another tag queryoptions as follows which solves my problem: