Is there a way, so that you can download the items from a list and all its item attachment files in one context call? Currently I am downloading all the items, then looping through each item, and getting its item id, then then making X ajax calls where X is the number of items, to get the item's attachments. Because I need the item ID so I know the link of the attachment folder.

Is there a way to do all this in 1 ajax call?


2 Answers 2


There is no way to do this by default. You could consider creating your own service.


Use /_vti_bin/listdata.svc/ListName()?&$expand=Attachments and you'll get back an 'Attachment' object on each result (or an additional node if you're using atom -- you XML weird-o!). The Attachments object contains a results array that contains 0 (if no attachments) or more attachment objects, each with a Name property that has the file name.

So if you're using JSON just use data.d.results[i].Attachments.results[j].Name and replace i and j with counters as you loop through your items -- if you replace both with 0 for example you'll get the first attachment on the first item in the result set.

You'll already know the rest of the attachment URL because it's just <site>/<list>/Attachments/<itemId>/ and then you can just add the name above to get the full link.

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.