I'm trying to access an SPS 2010 document library that contains folders, which in turn contain documents. I can successfully list the content of the library and see all folders and root-level documents, yet I can't figure out the way to list the contents of a library folder.

For example, a site has a library called Shared Documents, which in turn contains a folder called F1. I can successfully list the contents of the Shared Documents library:


and even retrieve details for the folder:


but I can't figure out how to list the contents of the folder F1. For example, the most obvious thing doesn't work:


This returns an error that I can't fathom:

The request URI is not valid. Since the segment 'SharedDocuments' refers to a collection, this must be the last segment in the request URI. All intermediate segments must refer to a single resource.

Neither does this:


That request errors out without much specific information.

Sadly, I have to use the REST API, no other methods are acceptable in this specific case. Is it even possible to list subfolders with the REST API on 2010?


In order to return items from a specific folder use $filter query option with Path property:

$filter=Path eq '<folder relative url>'


Assume a Documents library that contains Orders folder.

Then, the following REST query returns all documents located under Orders folder:

https://contoso.sharepoint.com/_vti_bin/ListData.svc/Documents?$filter=Path eq '/Shared Documents/Orders'


Use OData query operations in SharePoint REST requests

  • 1
    Thank you! I couldn't have figured that one out in another million years! Jun 25 '14 at 6:52
  • It's a good question indeed, glad this helped you! :) Jun 25 '14 at 6:57
  • If my SP URL is: localhost/org/uk/sms/shared documents/forms/allitems.aspx what would the Path variable be to get a REST XML list of documents in that folder?
    – Chris M
    May 20 '16 at 8:58

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.