0

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?

Edit:

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]">
  <id>46390b86-1167-4735-ba9e-880f06df0061</id>
  <title/>
  <updated>2017-10-14T13:56:31Z</updated>
  <author>
    <name/>
  </author>
</feed>

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!

0

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 Oct 13 '17 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 Oct 13 '17 at 22:36
  • I updated my question with the results i get! – rdnobrega Oct 14 '17 at 13:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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