I was wondering if it's possible to write am CAML query in SPO Online that also let's me search elements within folders in a list, so basically a recursive one.
In combination with PnP Powershell I'm able to find elements with this:
Get-PnPListItem -List $targetList -Query "<View><Query><Where><Eq><FieldRef
Name = 'FileLeafRef'/><Value Type =
'Text'>Test.txt</Value></Eq></Where></Query></View>"
However, this file is in the 'root' of the list. I'm not able to find test.txt if it lay in a folder.
I googled that CAML queries can have a 'scope' parameter 'query.ViewAttributes = "Scope='RecursiveAll'" that should do the trick. Unfortunately, I found no way to integrate this into PowerShell. In SharePoint 2013 it seems there's the possibility to create the query via the New-Object Microsoft.SharePoint.SPQuery class.
Any ideas or workarounds?
Thanks a lot in advance.