I would like to drill into the library and then into a specified folder, but I am having problems getting 'getFolderByServerRelativeUrl' to grab anything for me.
This http://_base/_api/web/getFolderByServerRelativeUrl('LibName')/files
returns zero results. But if I use http://_base/_api/web/lists/getbytitle('LibName')/items
it returns multiple items.
/_api/web/lists/getbytitle('<list title>')/items
endpoint returns all list items within a library, /_api/web/getFolderByServerRelativeUrl('<url>')/files
returns only files located under (one level beneath only) the specified folder.
Example
Assume the following Documents library structure:
Documents (library)
|
Guides (folder)
|
SharePoint User Guide.docx (file)
Then, the following request:
/_api/web/lists/getbytitle('Documents')/items
will return 2 items:
- list item associated with
Guides
folder
- list item associated with file
At the same time, the request: /_api/web/getFolderByServerRelativeUrl('Documents')/files
will returns 0
files since there are no files contained in the root folder
but the request with provided folder url:
/_api/web/getFolderByServerRelativeUrl('Documents/Guides')/files
will return SharePoint User Guide.docx
file.
You're using the wrong URL. Try appending it to the other URL.