I have a site which is running under SharePoint 2013. Via REST I am trying to retrieve the file and folder directory for that site. There are several similar questions on this site related to recursively retrieving all of the files and folders for a given a folder:
- Retrieve folders and sub folders from document library by REST call
- Get all Files and Folders in one call
The answers provided therein led me to the following URI:
/_api/web/Lists/GetByTitle('Documents')/Items?$expand=Folder&$select=Title,FileLeafRef,Folder/ServerRelativeUrl
Which from what I can tell does retrieve all of the files and folders from the given starting path.
However, I am missing something. When reading through the returned XML I cannot figure out where a given file goes. Meaning that I have info on how to retrieve file bros.pdf
, but cannot determine that it is in the documents/super/mario/
folder.
For the file items I've tried to retrieve the ServerRelativeUrl
property, but have not succeeded though the folders seem to. Is there some identifier in the XML that I am missing? When doing a recursive RESTful query how do I determine where a given file belongs?