The issue you are facing: Getting the error Principal with name myFolder not found
when using WebDAV Search.
Is this the first time you’ve seen this error? : Yes, but also the first time i try this function.
Steps to replicate it:
- Run the command
curl -u myUser:myPass 'https://nextcloud.customExample.com/remote.php/dav/' -X SEARCH -u myUser:myPass -H "content-Type: text/xml" --data '<?xml version="1.0" encoding="UTF-8"?>
<d:searchrequest xmlns:d="DAV:" xmlns:oc="http://owncloud.org/ns">
<d:basicsearch>
<d:select>
<d:prop>
<d:displayname/>
</d:prop>
</d:select>
<d:from>
<d:scope>
<d:href>/files/myFolder/myFile.apk</d:href>
<d:depth>infinity</d:depth>
</d:scope>
</d:from>
<d:where>
<d:like>
<d:prop>
<d:getcontenttype/>
</d:prop>
<d:literal>text/%</d:literal>
</d:like>
</d:where>
<d:orderby>
<d:prop>
<oc:size/>
</d:prop>
<d:ascending/>
</d:orderby>
</d:basicsearch>
</d:searchrequest>'
The output of your Nextcloud log in Admin > Logging:
<?xml version="1.0" encoding="utf-8"?>
<d:error xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns">
<s:exception>Sabre\DAV\Exception\NotFound</s:exception>
<s:message>Principal with name myFolder not found</s:message>
</d:error>
The folder myFolder is, as I see, in the root of my Nextcloud. I don’t know if I need something more to add before it (as I added “files”).
My objective is to check if a file exists in the nextcloud. I’ve asked for this in this forum before, but I didn’t get any answer so I’m still stuck in this step (now I’m trying to check it using the webDav search).
Thanks.