Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I'm looking to get a certain set of data from my list using the listdata.svc service with AJAX. The problem is inside the list I have folders, and I'd like to only receive elements inside a certain folder.

The list looks like this:

myList //list
    --> Folder001 //folder
        --> Item01 //listitem
        --> Item02 //listitem
        --> Item03 //listitem
    --> Folder002 //folder
        --> Item01 //listitem
        --> Item02 //listitem

So far I've found that I can add the attribute ?$filter= to the address but can't figure out how to use it to my advantage.

I see that each element has a "Path" value which ends with the folder. How would I go about only retreiving those entries from list whose "Path" attribute ends with a certain value, say "Folder0001"?

share|improve this question
add comment

1 Answer 1

up vote 1 down vote accepted

You can use $filter query string and a property called "Path" like

/_vti_bin/Listdata.svc/myList()?$filter=endswith(Path, 'Folder001')

to get only the items from the Folder001

share|improve this answer
    
Precisely what I needed, thank you! –  Rafał Saltarski Aug 16 '12 at 11:44
    
Glad we found a solution. It was an interesting question. –  Anatoly Mironov Aug 16 '12 at 12:07
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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