I'm currently trying to retrieve folders and files from my sharepoint server and for that, I'm using RESTful calls. The problem is that the method GetFolderByServerRelativeUrl is not returning a list of folders nor files. I made some different calls like:

/_api/Web/GetFolderByServerRelativeUrl('Relative Folder>')

/_api/Web/GetFolderByServerRelativeUrl('Relative Folder>')/Folders

/_api/Web/GetFolderByServerRelativeUrl('Relative Folder>')/Files

/_api/Web/GetFolderByServerRelativeUrl('Relative Folder>')?$expand=Folders,Files

The server does recognize that the folder exists. However, i cannot list the files no the subfolders in there. The result is always a short xml with some links but with no useful information.

Can someone help me with this? What am I doing wrong?


Here`s the result when i access the /files link:

<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:georss="http://www.georss.org/georss" xmlns:gml="http://www.opengis.net/gml" xml:base="[Site Api]">

As you can see, it does return an empty xml file! What can be wrong?

Edit 2:

Here's something new: when i try to access a specific file using /files('file name') it returns me File Not Found exception. It's odd, since i'm the one who created it! But when I try to get the file with GetFileByServerRelativeUrl it does return me the file!

1 Answer 1


I got the responses I was looking for when I fleshed out the URLs (more than I thought would be necessary:

https://Not.Really.Mine/Sitev2017/_api/web/getfolderbyserverrelativeurl('/Sitev2017/Shared%20Documents/3. Testing/Integration Test Scripts')/files

What specifically are you looking for. It is possible that this is an expectation misalignment.

  • Thanks for answering! Does the response contains a list of the files of the folder? thats what I am trying to achieve.
    – rdnobrega
    Commented Oct 13, 2017 at 21:59
  • Yes, but it is in the form of XML with all the metadata from the list. So it takes some parsing.
    – ghangas
    Commented Oct 13, 2017 at 22:36
  • I updated my question with the results i get!
    – rdnobrega
    Commented Oct 14, 2017 at 13:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.